Heim >Web-Frontend >HTML-Tutorial >html 表单点提交没反应?_html/css_WEB-ITnose
这是我用dreamweaver做的!程序如下:
document.getElementById("bd").submit()
<html><head><title>无标题文档</title><script type="text/javascript">function bdtj(){ if(document.bd.yhm.value.length===0){alert("用户名未输入!!!!") bd.yhm.focus(); return; } document.bd.submit() }</script></head><body><form id="bd" name="bd" method="post" action="cl.html"> <table width="266" height="239" border="1"> <tr> <td width="48">姓名:</td> <td width="105"><label for="yhm"></label> <input name="yhm" type="text" id="yhm" size="15" /></td> <td width="91"> </td> </tr> <tr> <td>性别:</td> <td><p> <label> <input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_0" /> 男</label> <label> <input type="radio" name="RadioGroup1" value="2" id="RadioGroup1_1" /> 女</label> </p></td> <td> </td> </tr> <tr> <td><input name="button" type="button" id="button" onClick="bdtj();" value="提交" /></td> <td> </td> <td><input type="button" name="button2" id="button2" value="取消" /></td> </tr> </table></form></body></html>
HTML code
document.getElementById("bd").submit()
.submit是什么意思.button可以吗
触发 form提交就是 submit 而不是 button