用层的概念,主要是把position: absolute;加上,如下
<div style="position: absolute; width: 100px; height: 100px; z-index: 1" id="layer1">
</div>
<div style="position: absolute; width: 100px; height: 100px; z-index: 1" id="layer1">
</div>
原设想是让一拉框在Table里面。可是Table会随着窗口的大小自动改变自己的位置<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<style> .menutitle{ font-family:黑体; font-size:15; width:100; height:14; background-color:#ff0000; position:absolute;top:80; }
.menu{ font-family:黑体; font-size:15; width:100; height:14; background-color:#000000; position:absolute;top:80; visibility:hidden; }
</style>
</HEAD>
<BODY onmouseover="hidemenu();" bgcolor="#000000">
<form id="Form1" method="post">
<p><font color="#0000ff" size="5" face="全真综艺体">下拉列表</font></p>
<hr>
<table cellSpacing="0" cellPadding="0" width="703" align="center" border="0">
<tr>
<td bgColor="#990000" height=20>
<span id="mt1" class="menutitle" style="Z-INDEX:2; LEFT:90px" onmouseover="showmenu();">
<font color="white">科技公司</font><br>
</span>
</td>
</tr>
</table>
<span id="m1" class="menu" style="Z-INDEX:1;LEFT:90px" onmouseover="showmenu();">
科技公司<br>
<a href="http://www.mgz.net.cn"><font color="white">mgz福彩网</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">bbb</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">aaa</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">cccdgfhs</font></a><br>
</span>
</form>
<script language="javascript">
function hidemenu(){
m1.style.visibility="hidden";
}
function showmenu(){m1.style.visibility="visible";
event.cancelBubble=true;
}
</script>
</BODY>
</HTML>
相对于<td> 的坐标,这样不管<td>如何变化,它里面的控件都会跟着<td>一起变化<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<style> .menutitle{ font-family:黑体; font-size:15; width:100; height:14; background-color:#ff0000; position:relative;top:3; }
.menu{ font-family:黑体; font-size:15; width:100; height:14; background-color:#000000; position:relative;top:0; visibility:hidden; }
</style>
</HEAD>
<BODY onmouseover="hidemenu();" bgcolor="#000000">
<form id="Form1" method="post">
<p><font color="#0000ff" size="5" face="全真综艺体">下拉列表</font></p>
<hr>
<table cellSpacing="0" cellPadding="0" width="703" align="center" border="0">
<tr>
<td bgColor="#990000" height="20">
<span id="mt1" class="menutitle" style="Z-INDEX:2; LEFT:10px" onmouseover="showmenu();">
<font color="white">科技公司</font><br>
</span>
<!--
“mt1”是相对于<td>,LEFT:10px表示与它相离10px
-->
<input type="text" id="p1" value="Button" size="50" style="Z-INDEX:5;LEFT:-30px;POSITION:relative">
<!--
"text"是相对于“mt1”,LEFT:-30px表示与它最后坐标相重叠
-->
</td>
</tr>
<tr>
<td>
<span id="m1" class="menu" style="Z-INDEX:1;LEFT:10px" onmouseover="showmenu();">
<a href="http://www.mgz.net.cn"><font color="white">mgz福彩网</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">bbb</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">aaa</font></a><br>
<a href="http://www.mgz.net.cn"><font color="white">cccdgfhs</font></a><br>
</span>
</td>
</tr>
</table>
</form>
<script language="javascript">
function hidemenu(){
m1.style.visibility="hidden";
}
function showmenu(){m1.style.visibility="visible";
event.cancelBubble=true;
}
</script>
</BODY>
</HTML>