在DREAMWEAVER里希望页面打开后希望几秒后关闭某一个层如何实现

语句是什么,谢谢
---------------------------------------------------------------

1<div id="test">hello</div>
1<script language="javascript">   
2setTimeout("test.style.visibility='hidden'",2000);//2秒   
3</script>

---------------------------------------------------------------

关闭层窗口

1.层的制作

 1<div id="KBStatic" style="position:absolute; left:338px; top:80px; z-index:25; overflow: visible; width: 151px; height: 112px; layer-background-color: #CCCCFF; border: 1px none #000000">
 2<table border="1" bordercolordark="#FF9900" bordercolorlight="#FF9900" cellspacing="1" width="151">
 3<tr bgcolor="#FFCC33">
 4<td>
 5<div align="right">
 6<a href="javascript:window.hideKBStatic()">×</a></div>
 7<center><b><font color="#FFFFFF">这就是层的效果</font></b><br/><br/>   
 8快把我关掉!<img align="right" src="0064.gif"/>
 9</center></td>
10</tr>
11</table>
12</div>

2、在

1<body>与</body>

里加上

 1<script language="JavaScript">   
 2  
 3function KB_keepItInIE(theName,theWantTop,theWantLeft) {   
 4  
 5theRealTop=parseInt(document.body.scrollTop)   
 6  
 7theTrueTop=theWantTop+theRealTop   
 8  
 9document.all[theName].style.top=theTrueTop   
10  
11theRealLeft=parseInt(document.body.scrollLeft)   
12  
13theTrueLeft=theWantLeft+theRealLeft   
14  
15document.all[theName].style.left=theTrueLeft   
16  
17}   
18  
19function KB_keepItInNN(theName,theWantX,theWantY) {   
20  
21theRealLay=document.layers[theName]   
22  
23theBadX=self.pageYOffset   
24  
25theBadY=self.pageXOffset   
26  
27theRealX=theBadX+theWantX   
28  
29theRealY=theBadY+theWantY   
30  
31theRealLay.moveTo(theRealY,theRealX)   
32  
33}   
34  
35IE4=(document.all)?1:0   
36  
37NN4=(document.layers)?1:0   
38  
39if (IE4)   
40  
41setInterval('KB_keepItInIE("KBStatic",260,600)',1)   
42  
43if (NN4)   
44  
45setInterval('KB_keepItInNN("KBStatic",200,500)',1)   
46  
47//关掉窗口   
48  
49function hideKBStatic()   
50{   
51KBStatic.style.visibility="hidden";   
52}   
53</script>
Published At
Categories with Web编程
comments powered by Disqus