<form method="post" action="test.htm" onsubmit="return true;" name="tempEmployeeForm" id="Employee_create_gs_temp">
<input type="submit" border="" onclick="this.setAttribute('disabled', 'true');" value="Submit"/>
<input type="button" border="" onclick="javascript:window.location.href='/employee/Employee_search.do'" value="Cancel" name="close"/></form>
上面这段代码在IE6下只会让按钮变灰, 而在FIREFOX中除变灰外, 还会提交表单, 这是为什么?

解决方案 »

  1.   

    <input type="submit" border="" onclick="this.disabled=true;return false;" value="Submit"/> 
      

  2.   

    onclick="this.setAttribute('disabled', 'true');return false;"
      

  3.   

    因为 IE 和 FF 的处理机制不同呗!建议将
    onclick="this.setAttribute('disabled', 'true');" 
    改为
    onclick="this.setAttribute('disabled', 'true');return false;" 
    试试看!
      

  4.   


    我是想让IE按钮变灰再提交, 现在连firefox都不能提交了
      

  5.   

    改成this.setAttribute('disabled', 'true');return true;
    在IE6下还是不能提交表单
      

  6.   

    哈哈,原来弄反了L@_@K<!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> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
    <form method="post" action="test.htm" onsubmit="return true;" name="tempEmployeeForm" id="Employee_create_gs_temp">
    <input type="submit" border="" onclick="this.setAttribute('disabled', 'true');this.form.submit();" value="Submit"/>
    <input type="button" border="" onclick="javascript:window.location.href='/employee/Employee_search.do'" value="Cancel" name="close"/> </form> </body>
    </html>
      

  7.   

    <input type="button" border="" onclick="this.setAttribute('disabled', 'true');document.getElementById('Employee_create_gs_temp').submit();" value="Submit"/> 
      

  8.   

    this.setAttribute('disabled', 'true'); 
    在 IE 中直接阻止了 form 的提交,与返回值没啥关系!Web 开发常用手册JScript语言参考.rar
    http://download.csdn.net/source/308916DHTML参考手册.rar
    http://download.csdn.net/source/308913样式表中文手册.chm
    http://download.csdn.net/source/304124