jasmine214--love

只有当你的内心总是充满快乐、美好的愿望和宁静时,你才能拥有强壮的体魄和明朗、快乐或者宁静的面容。
posts - 731, comments - 60, trackbacks - 0, articles - 0

DIV--重叠

Posted on 2010-07-04 22:19 幻海蓝梦 阅读(533) 评论(0)  编辑  收藏 所属分类: JS
< div id = id1 >
< div id = id2 >< table width = " 180 "  border = " 0 "  cellspacing = " 0 "  cellpadding = " 0 " >
  
< tr >
    
< td height = " 10 " >   </ td >
  
</ tr >
  
< tr >
    
< td height = " 30 "  style = " font-size:14px; font-weight:bold; " > Product Type </ td >
  
</ tr >
  
<% set rec = conn.execute( " select * from Class where PartID='0' order by Classorder " )
       i
= 1  
  
while  not rec.eof %>
  
< tr >
    
< td height = " 30 "  onmousemove = " kk(<%=40+(i-1)*30%>,'<%=rec( " ok " )%>') "  onmouseout = " ll() " >< a href = " products.asp?ClassID=<%=rec( " NumberID " )%> "   class = " a3 "  target = " _blank "   ><%= rec( " Class " ) %></ a ></ td >
  
</ tr >
   
<% rec.movenext
   i
= i + 1
   wend
   rec.close
   set rec
= nothing %>
</ table >
</ div >
< div id = img1 style = " display:none; position:relative; float:left; left:0px; width:200px; " >
< img src = ""  width = " 100 "  height = " 100 "  id = " img2 "  name = " img2 "   />
</ div >

< script language = " javascript " >
<!--
function kk(x,image)
{
 img1.style.display
= '' ;
 img1.style.top
= x;
 img2.src
= image;
}

function ll()
{
 img1.style.display
= ' none ' ;
}

-->
</ script >
</ div >
我想img1显示在id2的上面,遮掩id2的内容,但在id1有范围内,怎么设CSS 
#id1 {position:relative;}
#img1
{position:absolute;top:0px;left:0px;}

< div id = " id1 " >
 
< div id = " img1 " ></ div >
 
< div id = " id2 " ></ div >
</ div >  
补充; 我想让div1和div2的重叠部分div1的盖在div2的上面,如何实现。
加样式 position:relative;
div1的加 z-index:2;
div2的加 z-index:1;

只有注册用户登录后才能发表评论。


网站导航: