<img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image1" onmousemove="show('image1')" />
将里面的双引号改成单引号试试 而且你应该在<div id="layer1">你好我是第一层</div>
里面定义<div id="layer1" style="display='none'">你好我是第一层</div> 最后 你的obj1.style.diplay="none"; 错了 应该是display 修改之后可运行的代码如下:
<html>
<body>
<table width="600" border="1">
<tr>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image1" onmousemove="show('image1')" /></td>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image2" onmousemove="show('image2')" /></td>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image3" onmousemove="show('image3')"/></td>
</tr>
<tr>
<td colspan="3">
<div id="layer1" style="display='none'">你好我是第一层</div>
<div id="layer2" style="display='none'">你好我是第二层</div>
<div id="layer3" style="display='none'">你好我是第三层</div>
</td>
</tr>
</table>
</body>
</html>
<script language="javascript" type="text/javascript">
function show(s)
{
var obj1=document.getElementById("layer1");
var obj2=document.getElementById("layer2");
var obj3=document.getElementById("layer3");
if(s=="image1")
{
obj1.style.display="block";
obj2.style.display="none";
obj3.style.display="none";
}
if(s=="image2")
{
obj2.style.display="block";
obj1.style.display="none";
obj3.style.display="none";
}
if(s=="image3")
{
obj3.style.display="block";
obj2.style.display="none";
obj1.style.display="none";
}
}
</script>
将里面的双引号改成单引号试试 而且你应该在<div id="layer1">你好我是第一层</div>
里面定义<div id="layer1" style="display='none'">你好我是第一层</div> 最后 你的obj1.style.diplay="none"; 错了 应该是display 修改之后可运行的代码如下:
<html>
<body>
<table width="600" border="1">
<tr>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image1" onmousemove="show('image1')" /></td>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image2" onmousemove="show('image2')" /></td>
<td><img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" id="image3" onmousemove="show('image3')"/></td>
</tr>
<tr>
<td colspan="3">
<div id="layer1" style="display='none'">你好我是第一层</div>
<div id="layer2" style="display='none'">你好我是第二层</div>
<div id="layer3" style="display='none'">你好我是第三层</div>
</td>
</tr>
</table>
</body>
</html>
<script language="javascript" type="text/javascript">
function show(s)
{
var obj1=document.getElementById("layer1");
var obj2=document.getElementById("layer2");
var obj3=document.getElementById("layer3");
if(s=="image1")
{
obj1.style.display="block";
obj2.style.display="none";
obj3.style.display="none";
}
if(s=="image2")
{
obj2.style.display="block";
obj1.style.display="none";
obj3.style.display="none";
}
if(s=="image3")
{
obj3.style.display="block";
obj2.style.display="none";
obj1.style.display="none";
}
}
</script>
<script language="javascript" type="text/javascript">
function show(s)
{
for(var i=1;i<4;i++)
{
document.getElementById("layer"+i).style.display="none";
}
document.getElementById("layer"+s).style.display="block";
}
</script>
<table width="600" border="1">
<tr>
<td> <img src="../../../yixing/webdesignicon_233.png" width="32" height="19" name="image1" onmousemove="show('1')" /> </td>
<td> <img src="../../../yixing/webdesignicon_233.png" width="32" height="19" name="image2" onmousemove="show('2')" /> </td>
<td> <img src="../../../yixing/webdesignicon_233.png" width="32" height="19" name="image3" onmousemove="show('3')"/> </td>
</tr>
<tr>
<td colspan="3">
<div id="layer1" style="z-index:1; display:block; height:100px; background-color:#000099">你好我是第一层 </div>
<div id="layer2" style="z-index:2; display:none; height:100px; background-color:#00CC99">你好我是第二层 </div>
<div id="layer3" style="z-index:3; display:none; height:100px; background-color:#FF0000">你好我是第三层 </div>
</td>
</tr>
</table>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<script language="javascript" type="text/javascript">
function $(id){return document.getElementById(id)}
function hidAll(){
for (var i=1;i<4;i++)$("layer"+i).style.display="none";
}function show(s) {
hidAll()
$(s).style.display="block";
}
onload=function(){show("layer1")
}
</script> 想实现鼠标移到图片的时候隐藏显示层,不过调试了很长时间就是不行!
<table width="600" border="1">
<tr>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image1" onmousemove="show('layer1')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image2" onmousemove="show('layer2')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image3" onmousemove="show('layer3')"/> </td>
</tr>
<tr>
<td colspan="3">
<div id="layer1">你好我是第一层 </div>
<div id="layer2">你好我是第二层 </div>
<div id="layer3">你好我是第三层 </div>
</td>
</tr>
</table>
</body></html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<script language="javascript" type="text/javascript">
function $(id){return document.getElementById(id)}
function hidAll(){
for (var i=1;i<4;i++)$("layer"+i).style.display="none";
}function show(s) {
hidAll()
$(s).style.display="block";
}
onload=function(){show("layer1")
}
</script> 想实现鼠标移到图片的时候隐藏显示层,不过调试了很长时间就是不行!
<table width="600" border="1">
<tr>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image1" onmousemove="show('layer1')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image2" onmousemove="show('layer2')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image3" onmousemove="show('layer3')"/> </td>
</tr>
<tr>
<td colspan="3">
<div id="layer1">你好我是第一层 </div>
<div id="layer2">你好我是第二层 </div>
<div id="layer3">你好我是第三层 </div>
</td>
</tr>
</table>
</body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<script language="javascript" type="text/javascript">
function $(id){return document.getElementById(id)}function show(s) {
for (var i=1;i<4;i++)$("layer"+i).style.display="none";
$(s).style.display="block";
}
onload=function(){show("layer1")
}
</script> <table width="600" border="1">
<tr>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image1" onmousemove="show('layer1')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image2" onmousemove="show('layer2')" /> </td>
<td> <img src="file:///E|/yixing/webdesignicon_233.png" width="32" height="19" name="image3" onmousemove="show('layer3')"/> </td>
</tr>
<tr>
<td colspan="3">
<div id="layer1">你好我是第一层 </div>
<div id="layer2">你好我是第二层 </div>
<div id="layer3">你好我是第三层 </div>
</td>
</tr>
</table>
</body></html>