<div class="codetitle"> <span><a style="CURSOR: pointer" data="38999" class="copybut" id="copybut38999" onclick="doCopy('code38999')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code38999"> <br>/* <br><a href="a.html" onclick="return $.qbox(this);"> <br></a><a href="a.html" onclick="return qBox.iFLoad(this);"> <br></a><a href="a.html" onclick="return qBox.iFrame({src:'b.html'})"> Boxy属性不变 新增 w、h、src 属性 <br>qBox.Close();关闭当前窗口 <br>qBox.iFSrc({}); 改变当前窗口的属性及指向 Boxy属性不变 新增 w、h、src 属性 <br>*/ <br><br>//Boxy插件的扩展 <br>jQuery.fn.qbox=function(options){ <br>var node = this.get(0).nodeName.toLowerCase(); <br>var self=this; <br>if (node == 'a') { <br>$(this).attr('onclick','').unbind('click').click(function(){return false;}); <br>options = $.extend(options||{},{src:this.get(0).getAttribute('href'),beforeUnload:function(){ $(self).unbind('click').click(function(){return $(this).qbox(options);});}}); <br>} <br>qBox.iFLoad(options); <br>return false; <br>} <br>var qBox=function(){}; <br>jQuery.extend(qBox,{ <br>aDgs:[], <br>iFrame:function(op){ <br>op = jQuery.extend({title:'提示',w:320,h:200,src:'about:blank',modal:false,fixed:false,unloadOnHide:true},op),fm=parseInt(Math.random()*(1000*987));// <br>var dialog = new Boxy("<b id='\"ld"+fm+"\"'>正在加载,请稍后....</b><iframe id='\"_"+fm+"\"' style='\"width:0;height:0;display:none;padding:0;\"' src="+op.src+" frameborder='\"0\"' scrolling='\"no\"'></iframe>",op); <br><br>jQuery("#_"+fm).load(function(){ <br>dialog.resize(op.w,op.h,function(){}); <br>jQuery("#ld"+fm).remove(); <br>jQuery("#_"+fm).css({'padding':'15px','display':''}); <br>}); <br>qBox.aDgs.push(dialog); <br>return false; <br>}, <br>Close:function(){ <br>qBox.aDgs[qBox.aDgs.length-1].hide(); <br>return false <br>}, <br>iFSrc:function(op){ <br>op = jQuery.extend({w:320,h:200,src:'about:blank'},op); <br>qBox.aDgs[qBox.aDgs.length-1].getContent().attr("src","about:blank"); <br>qBox.aDgs[qBox.aDgs.length-1].setTitle(op.t); <br>qBox.aDgs[qBox.aDgs.length-1].tween(op.w,op.h,function(){qBox.aDgs[qBox.aDgs.length-1].getContent().attr("src",op.src).css({width:op.w,height:op.h});}); <br>return false; <br>}, <br>iFLoad:function(options){ <br>var sr= jQuery(this).attr("href"); <br>var op = jQuery.extend({src:sr},options); <br>qBox.iFrame(op); <br>return false; <br>} <br>}); <br><br></a> </div> <br>出处 cn795.cnblogs.com