复制代码 代码如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<title>查字典教程网-弹出一个层</title>
<scriptlanguage="javascript">
functioncmsgbox(vtitle,vwidth,vhight,vtop,vleft)
{
this.title=vtitle;
this.width=vwidth;
this.height=vhight;
this.top=vtop;
this.left=vleft;
this.id=0;
}
cmsgbox.prototype.showdiv=function()
{
varstr="";
str+="<divid='div1'style='z-index:1;background-color:white;position:absolute;border:2pxsolidslategray;left:"+this.vleft+"px;top:"+this.vtop+"px;width:"+this.width+"px;'>";
str+="<divstyle='padding-bottom:2px;background-color:slategray;width:100%;height:16px;color:white;'>";
str+="<divstyle='float:left;height:16px;overflow:hidden;margin:0px;padding:4px0px0px5px;width:"+(parseInt(this.width)-24*2-5)+"px;'>"+this.title+"</div>";
str+="<spanstyle='width:14px;font-family:webdings;cursor:hand;'>0</span>";
str+="<spanstyle='width:14px;font-family:webdings;cursor:hand;'onclick='cmsgbox.closediv(this);'>r</span>";
str+="</div>";
str+="<divstyle='margin:10px5px10px10px;word-break:break-all;'>";
str+="xxx";
str+="</div>";
str+="</div>";
//document.write(str);
document.body.insertAdjacentHTML("beforeEnd",str);
}
/////////////////////窗口显示//////////////////////////////
functionshow()
{
varbox=newcmsgbox('小家伙呀',400,300);
box.showdiv();
}
</script>
</head>
<style>
body{
font-size:12px;
}
</style>
<body>
<ponclick="show();">弹了一个层</p>
</body>
</html>
【利用js对象弹出一个层】相关文章:
★ 对联广告
★ 对联广告 可关闭
★ 获取对象