本帖最后由 sssschenyi 于 2010-03-10 21:12:31 编辑

解决方案 »

  1.   

    你的IF语句判断条件里面不是判断,而是赋值.
    if(document.getElementById("erdiv").style.display="none")
    应该是
    if(document.getElementById("erdiv").style.display=="none")
      

  2.   

    少写了一个等号<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>div</title>
    <SCRIPT TYPE="text/javascript">
    <!--
    function chenyi(){
    if(document.getElementById("erdiv").style.display=="none"){
    document.getElementById("erdiv").style.display="block";
    }
    else {
    document.getElementById("erdiv").style.display="none";
    }
    }            function exit(){
                document.getElementById("erdiv").style.display="none";
                }// -->
    </SCRIPT><style type="text/css">
    <!--
    #erdiv{
    display: none;
    } #title{
    background-color: red;
    height: 20px;
    width: 300px;
    border: thin solid #000000; 
    } #content {
    background-color: pink;
    height: 280px;
    width: 300px;
    border: thin solid #000000; 
    } span{
    cursor: pointer;
    padding-left: 185px;
    }
    -->
    </STYLE>
    </head> <body>
    <p><a href="javascript:" onclick="chenyi()">点我看看!</a></p>
    <div id="erdiv">
    <div id="title">i'm is title  <span onclick="exit()">X</span></div>
    <div id="content">i'm is content</div>
    </div>
    </body>
    </html>
      

  3.   

    谢谢your