html 表单点提交没反应?

hilivivi 2012-05-22 08:22:34
这是我用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"> </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>

点击提交后怎么没有跳转到cl.html网页
...全文
1111 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
001007009 2012-05-22
  • 打赏
  • 举报
回复 1
触发 form提交就是 submit 而不是 button
hilivivi 2012-05-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

HTML code

document.getElementById("bd").submit()
[/Quote]
.submit是什么意思.button可以吗
001007009 2012-05-22
  • 打赏
  • 举报
回复

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




楼主 试试
人生无悔 2012-05-22
  • 打赏
  • 举报
回复

document.getElementById("bd").submit()

61,110

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧