asp提交的问题 为什么不填内容点提交没有反映

来源:百度知道 编辑:UC知道 时间:2024/05/28 15:22:08
<script language="vbscript">
sub tijiao_onclick()
if form.name.value="" or form.boby.value="" then
alert "内容不能为空"
end sub
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form action="" method="post" name="form">
姓名:<input type="text" name="name"><br><br>
内容:<input type="text" name="boby"><br><br>
<input type="submit" name="tijiao" value="提交">
</form>

这不能这么写吧 ...

你这真是把 VBScript 和 JavaScript 掺和到一块儿阿 ...

不推荐在 HTML 里面用 VBScript ...

写成这样你看看 ...?

<script language="javascript">
function yanzi() {
if ( form.name.value=="" || form.boby.value=="") {
alert("内容不能为空");
return false;
}
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form action="" method="post" name="form" onsubmit="yanzi()">
姓名:<input type="text" name="name"><br><br>
内容:<input type="text" name="boby"><br><br>
<input type="submit" name="tijiao" value="提交">
</form>

刚才没看你的脚本。vbscript中没