<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> 

解决方案 »

  1.   

    楼上正解。你用getElementByName,可表单里的div又没有name属性。改用getElementById才对
      

  2.   


    <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>
      

  3.   

    用一个for能让这个程序更为简洁``
      

  4.   

    lz这种手误建议使用 firefox + firebug插件 调试。
      

  5.   

    还有 ,JavaScript中没有现成 getElementByName ,只有getElementsByName
      

  6.   


    <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>
      

  7.   


    <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>
      

  8.   

    LS发错了^_^<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 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>