为什么要 document.write 去掉这句看看

解决方案 »

  1.   

    document.write重写了页面之后还怎么提交??
      

  2.   


    function message3() { 
    document.write("hello"); 
    return true; 
    } 你改成
    function message3() { 
    alert("hello");
    //document.write("hello"); 
    return true; 
    } 就可以
      

  3.   

    因为你是在页面已经加载完毕之后对页面进行的document.write操作 它将会重构页面 也就是说你的form已经不存在了 哪来的提交你试试这个代码function message3() { 
    alert(document.forms.length);
    //alert("hello");
    document.write("hello"); 
    alert(document.forms.length);  //得到的是0 也就是form已经不存在了
    return true; 

      

  4.   

    不要用document.write("hello"); 
    它会把当前页的内容抹掉因此即使return true,也不会action到你指定的那个页面
      

  5.   

    6楼讲得很清楚了,楼主这个不是onsubmit的问题,应该是文档未载入和已载入后document.write()的区别问题。