87,975
社区成员
发帖
与我相关
我的任务
分享
//弹出窗口
var Dialog = {
//皮肤图片
skin: "/image/dialog1.png",
//弹出窗口
Open : function(url, w, h, title, iscenter, ismask, isdarg){
if($("#rf_dialog").length > 0){return;}
//sys.loadcss(this.css);
var arr = [];
arr.push("<div id=\"rf_dialog\" style=\"font-size:12px;position:absolute;z-index:9999999999\">")
arr.push("<table style=\"width:"+ (w + 26) +"px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">")
arr.push("<tr style=\"cursor:pointer;\" id=\"rf_dialog_head\">");
arr.push("<td style=\"width:13px;height:33px;background:url("+ this.skin +") 0 0 no-repeat\"></td>");
arr.push("<td style=\"width:"+ w +"px;height:33px;background:url("+ this.skin +") -200px 0 repeat-x\">");
arr.push("<div style=\"width:15px;height:33px;float:left;background:url("+ this.skin +") -26px 0 no-repeat;margin-left:5px\"></div>");
arr.push("<div style=\"float:left;font-weight:bold;color:#fff;margin-top:15px\" onselectstart=\"return false\">" + title + "</div> ");
arr.push("<div style=\"height:17px;width:28px;float:right;background:url("+ this.skin+") 0 -40px no-repeat;margin-top:8px;cursor:pointer\" onmouseover=\"this.style.background='url("+ this.skin +") 0 -60px no-repeat'\" onmouseout=\"this.style.background='url("+ this.skin +") 0 -40px no-repeat'\" drag='false' onclick=\"Dialog.Close();\"></div>")
arr.push("</td>");
arr.push("<td style=\"width:13px;height:33px;background:url("+ this.skin +") -13px 0px no-repeat\"></td>");
arr.push("</tr>");
arr.push("<tr>");
arr.push("<td style=\"width:13px;background:url("+ this.skin +") -40px 0 repeat-y\"></td>");
arr.push("<td style=\"width:"+ w +"px;height:"+ h +"px;background:#fff url("+ this.skin +") -200px -60px repeat-x\">");
arr.push("<iframe src=\""+ url +"\" width=\"100%\" height=\"100%\" frameborder=\"no\" scrolling=\"yes\"></iframe>");
arr.push("</td>");
arr.push("<td style=\"width:13px;background:url("+ this.skin +") -60px 0 repeat-y\"></td>");
arr.push("</tr>");
arr.push("<tr>");
arr.push("<td style=\"width:13px;height:13px;background:url(" + this.skin + ") -70px 0 no-repeat\"></td>");
arr.push("<td style=\"width:" + w + "px;height:13px;background:url(" + this.skin + ") -200px -40px repeat-x;\"></td>");
arr.push("<td style=\"width:13px;height:13px;background:url(" + this.skin + ") -90px 0 repeat-y\"></td>");
arr.push("</td>");
arr.push("</table>");
arr.push("</div>");
$("body").append(arr.join('\n'));
if(iscenter){this.Center(w, h);}
if(ismask){this.Mask();}
if(isdarg){this.Drop("rf_dialog");}
},
//窗口居中
Center : function(w, h){
$("#rf_dialog").css("top", ($(window).height() - h) / 2 + $(window).scrollTop() + "px");
$("#rf_dialog").css("left", ($(window).width() - w) / 2 + $(window).scrollLeft() + "px");
},
//遮罩
Mask : function(){
$("body").append("<div id=\"rf_dialog_mask\" style=\"width:100%;height:100%;position:absolute;top:0;left:0;background:#33393c;filter:alpha(opacity=30);opacity:0.30;-moz-opacity:0.3;z-index:900\"></div>");
//document.body.style.overflow = "hidden";//禁止出现滚动条
var pwbody=document.getElementsByTagName(isQuirks?"body":"html")[0];
pwbody.style.overflow="hidden";
},
//关闭窗口
Close : function(){
$("#rf_dialog").remove();
$("#rf_dialog_mask").remove();//
//document.body.style.overflow = "auto";//还原滚动条
var pwbody=document.getElementsByTagName(isQuirks?"body":"html")[0];
pwbody.style.overflow="auto";
},
Drop : function(obj){
var A=new Function('obj','return document.getElementById(obj);')
var B=new Function('e','if (!e) e = window.event;return e')
var x,y;
A(obj).onmousedown=function(e){
drag_=true;
with(this){
style.position="absolute";var temp1=offsetLeft;var temp2=offsetTop;
x=B(e).clientX;y=B(e).clientY;
document.onmousemove=function(e){
if(!drag_)return false;
with(this){
style.left=temp1+B(e).clientX-x+"px";
style.top =temp2+B(e).clientY-y+"px";
}
}
}
document.onmouseup=new Function("drag_=false");
}
}
};
<a href = "xxx.html" target = "A"></a>
A是你想要弹出的那个父框架的id