国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

利用js對象彈出一個層

2019-11-21 01:47:49
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>武林網-彈出一個層</title> 
<script language="javascript"> 
function cmsgbox(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() 

 var str=""; 
 str+="<div id='div1' style='z-index:1;background-color:white;position:absolute;border:2px solid slategray;left:"+this.vleft+"px;top:"+this.vtop+"px;width:"+this.width+"px;'>"; 

 str+="<div style='padding-bottom:2px;background-color:slategray;width:100%;height:16px;color:white;' >"; 
 str+=" <div style='float:left;height:16px;overflow:hidden;margin:0px;padding:4px 0px 0px 5px;width:"+(parseInt(this.width)-24*2-5)+"px;'>"+this.title+"</div>"; 
 str+=" <span style='width:14px;font-family:webdings;cursor:hand;'>0</span>"; 
 str+=" <span style='width:14px;font-family:webdings;cursor:hand;'  onclick='cmsgbox.closediv(this);'>r</span>"; 
 str+="</div>"; 

 str+="<div style=' margin:10px 5px 10px 10px;word-break:break-all;'>"; 
 str+="xxx"; 
 str+="</div>"; 
 str+="</div>"; 
 //document.write(str); 
 document.body.insertAdjacentHTML("beforeEnd",str); 

/////////////////////窗口顯示////////////////////////////// 
function show() 

 var box=new cmsgbox('小家伙呀',400,300); 
 box.showdiv(); 

</script> 
</head> 

<style> 
body{ 
 font-size:12px; 

</style> 
<body> 
<p onclick="show();">彈了一個層</p> 
</body> 
</html> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宜春市| 山西省| 大丰市| 永福县| 泾川县| 宁强县| 泾源县| 长治县| 南皮县| 家居| 扶绥县| 汽车| 巴中市| 张家口市| 来安县| 武陟县| 息烽县| 遵义县| 邢台县| 珲春市| 晋宁县| 康平县| 嘉荫县| 政和县| 宜章县| 东平县| 崇仁县| 芜湖市| 饶河县| 广西| 时尚| 南雄市| 固阳县| 阿拉善盟| 长治县| 高碑店市| 原平市| 晋州市| 潮安县| 会昌县| 盘山县|