主题:关于聊天室的问题?
以下代码不知道为何不能实现首页用户名为空弹出警告对话框,我没写用户名还是直接进入了聊天室的页面?请问如何修改?
<html>
<head>
<title>聊天室</title>
<Script Language="JavaScript">
<!--
Function check_Null(){
If (document.form1.user_name.value==""){
alert("呢称不能为空!");
return false;
}
return true;
}
// -->
</Script>
</head>
<body >
<h2 align="center">小小聊天室</h2>
<center>
现在共有<%=Application("user_online")%>人在线<p>
<form method="post" action="chat.asp" name="form1" onsubmit="JavaScript: return check_Null();">
请输入呢称<input type="text" name="user_name" size="10">
<input type="submit" value=" 进 入 ">
</form>
</center>
</body>
</html>
<html>
<head>
<title>聊天室</title>
<Script Language="JavaScript">
<!--
Function check_Null(){
If (document.form1.user_name.value==""){
alert("呢称不能为空!");
return false;
}
return true;
}
// -->
</Script>
</head>
<body >
<h2 align="center">小小聊天室</h2>
<center>
现在共有<%=Application("user_online")%>人在线<p>
<form method="post" action="chat.asp" name="form1" onsubmit="JavaScript: return check_Null();">
请输入呢称<input type="text" name="user_name" size="10">
<input type="submit" value=" 进 入 ">
</form>
</center>
</body>
</html>