我只知道,这写法现在是非常的不合适用了,使用document.getElementById("id")之类的标准写法比较好,兼容性也好

解决方案 »

  1.   

    哈哈,原因是因为你用的submit按扭,跟JS屁的关系!!!
    你把你的按扭改成button类型。就是type="button"调用JS按扭的时候,不要用input type="submit"
      

  2.   

    是不是後面又有form.submit()的語句,沒達到自己想要的條件就執行了
      

  3.   

    果然想象力丰富,嘎嘎~~
    1.点的触发Input是submit
    2.LZ在代码最后有提交语句,判断条件不成立时没有退出函数解决:1.触发Input设为Button类型或用<Button></Button>;
    2.建议使用document.getElementById("id").value/document.getElementById("id").focus()等;
    判断条件不成立的全部return false;
    (给form与input同时设id和name属性,最好两个值一样)
      

  4.   

    使用document.getElementById("id")之类的标准   这种标准哪有资料啊,另外按钮提交的验证怎么实现啊function checkform(){ 
            var snameObj,sphoneObj;
    snameObj=document.getElementById("sname");
    sphoneObj=document.getElementById("phto");
    if(snameObj.value=="") return true;
    if(sphoneObj.value=="") return true;

    }
    按钮代码:
        <input type="button" value=点此发布 name=aaa onClick="if(checkform()) alert('   请将资料填写完整!'); else {form.submit();}">望专家们给分析一下谢谢
      

  5.   

    最好能把代码贴全,省得大家为了测试,又要写一遍。<!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>
    <script language="javascript">
    function checkform()
    {
    var snameObj = document.getElementById("sname"); 
    var sphoneObj = document.getElementById("phto"); 
    if(snameObj.value == "") return true; 
    if(sphoneObj.value == "") return true; 
    } </script>
    按钮代码: 
    <form>
    <input name="sname" value="" />
    <input name="phto" value="" />
        <input type="button" value="点此发布" name="aaa" onClick="if(checkform()) alert('请将资料填写完整!'); else form.submit()"> 
    </form>
    </body>
      

  6.   

    这是全码:在火狐中检查空值正常,填写完整后点按钮无效,请教如何实现提交,问题处在哪?谢谢
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head>
    <body><script language="javascript">
    function checkform()
    {
        var snameObj = document.getElementById("sname"); 
        var sphoneObj = document.getElementById("phto"); 
        if(snameObj.value == "") return true; 
        if(sphoneObj.value == "") return true; 

    </script>
    按钮代码: 
    <form action="/Search.asp" name="form1" id="form1">
        <input name="sname" id="sname" value="" />
        <input name="phto" id="phto" value="" />
        <input type="button" id="aaa" value="点此发布" name="aaa" onClick="if(checkform()) alert('请将资料填写完整!'); else form1.submit()"> 
    </form>
    </body>
    </html>
      

  7.   

    刷新?这句不可能刷新的啊!不过你是不是在表单里用了<button>标签?这个标签在FF里会自动提交表单的
      

  8.   

    哈哈,谢谢各位了,现在解决了,忘了在条件不成立的时候使用return false了,所以导致下面的代码也被执行了!