首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

html 表单点提交没反应?解决方法

2012-05-28 
html 表单点提交没反应?这是我用dreamweaver做的!程序如下:htmlheadtitle无标题文档/titlescript

html 表单点提交没反应?
这是我用dreamweaver做的!程序如下:

<html>
<head>
<title>无标题文档</title>
<script type="text/javascript">
function bdtj()
{
 if(document.bd.yhm.value.length===0)
{alert("用户名未输入!!!!")
  bd.yhm.focus();
  return;
 }
 document.bd.button()
 }
</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">&nbsp;</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>&nbsp;</td>
  </tr>
  <tr>
  <td><input name="button" type="button" id="button" onClick="bdtj();" value="提交" /></td>
  <td>&nbsp;</td>
  <td><input type="button" name="button2" id="button2" value="取消" /></td>
  </tr>
  </table>
</form>
</body>
</html>

点击提交后怎么没有跳转到cl.html网页


[解决办法]

HTML code
document.getElementById("bd").submit()
[解决办法]
HTML code
<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">&nbsp;</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>&nbsp;</td>  </tr>  <tr>  <td><input name="button" type="button" id="button" onClick="bdtj();" value="提交" /></td>  <td>&nbsp;</td>  <td><input type="button" name="button2" id="button2" value="取消" /></td>  </tr>  </table></form></body></html> 


[解决办法]
触发 form提交就是 submit 而不是 button

热点排行