日期:2014-05-17  浏览次数:20669 次

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="