<script language="javascript"> 
function BodyOnload()
{
InitClass(0,0);  //页面加载的时候,自动执行这JS(即:初始状态)

</script> 
在body里加上
<body onload="BodyOnload()">
</body>这样行不?

解决方案 »

  1.   


    test1.html<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript"> 
    function BodyOnload() 

    alert("sdfasdfasdfsdf");  //页面加载的时候,自动执行这JS(即:初始状态) 

    </script>  
    </head><body onload="BodyOnload()">
    <form action="test2.html" method="post">
    <input type="submit" value="sdfasdfasdf">
    </form>
    </body>
    </html>test2.html<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
     
    </head><body></body>
    </html>
    测试通过
      

  2.   

    我也发现这个问题了,不知道history.back后会不会触发某些事件
      

  3.   

    上面代码中test1点击按钮会转到test2页面, 在test2页面点返回test1后,会执行test1里的alert.符合你的要求, 返回后初始化
      

  4.   

    呵呵~~初始化最好直接写在body中,就不会出现数据不一致的情况了
      

  5.   

    增加一个隐藏的reset控件,再次加载的时候直接调用click事件
    <input type="reset" name="reset1" value="" style="display:none" >
    <script>
    form.reset1.click();
    </script>
      

  6.   

    增加一个隐藏的reset控件,再次加载的时候直接调用click事件
    <input type="reset" name="reset1" value="" style="display:none" >
    <script>
    form.reset1.click();
    </script>