注册 登录
编程论坛 ASP技术论坛

为什么,我写的javasrcipt代码怎么没用,插入在ASP没起作用呢

seep666 发布于 2011-05-08 18:45, 433 次点击
javascript代码在最下面,前面都是用html,求解
html代码没错,只是javascript没起作用
<style type="text/css">
<!--
.STYLE1 {
    font-size: 36px;
    font-weight: bold;
}
.STYLE2 {color: #CCCCCC}
.STYLE3 {color: #FFFFFF}
-->
</style>
<div align="center" class="STYLE1">
  <p>我的留言版</p>
</div>
<form  name="logn" method="post" action="insert.asp" onsubmit="return check" style="background:#000000"
>
  <label><span class="STYLE2">主题:
  <input name="usertitle" type="text" id="usertitle" size="40" maxlength="50" />
  </span></label>
  <p>
    <span class="STYLE2">
    <label>内容:    </label>
    </span>
    <label>
    <textarea name="userbody" cols="60" rows="4" id="userbody"></textarea>
    </label>
  </p>
  <p>
    <label><span class="STYLE3">姓名:</span>   
    <input name="username" type="text" id="username" size="15" />
    </label>
  </p>
  <p><span class="STYLE3">E_mail</span>:
    <input name="usere_mail" type="text" id="usere_mail" size="25" />
  
  <p>&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;
  <input type="submit" name="Submit" value="提  交" />
 </p>
</form>
<p>
  <label></label>
</p>
<%@language=vbscript%>
<script language="javascript">
function check()
{
 if(document.logn.usertitle.value=="")
{
alert("主题不能为空");
return false;
}
if(document.logn.username.value=="")
{
alert("名字不能为空");
return false;
}
if(document.logn.usertitle.value.length>50)
{
alert("主题不能大于50个");
return false;
}
return true;
}
</script>
2 回复
#2
wangjy5002011-05-08 20:09
onsubmit="return check()"
#3
sunfishy2011-05-08 21:52
<form  name="logn" method="post" action="insert.asp" onsubmit="return check()" style="background:#000000">
1