各位大侠帮帮忙asp表单验证的问题

来源:百度知道 编辑:UC知道 时间:2024/05/03 01:57:43
代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
<!--
body {
background-color: #9999CC;
}
input {
background-color: #D5D5EA;
}
textarea {
background-color: #D5D5EA;
}
table {
font-size: 12px;
text-decoration: none;
border: thin dashed #8484C1;
}
td {
font-size: 12px;
border: thin dotted #8484C1;
text-align: left;
}
-->
</style></head>
<center>
<body>
用户注册<br>
<form name="form1" method="post" action="">
<table width="39%" height="105" border="0" >
<tr>
<td width="27%">用户名:</td>
<td width="73%">&

<SCRIPT language=javascript>
function Show(id)
{
id.style.display="";
}
function Hide(id)
{
id.style.display="none";
}

function Check()
{
if (user.value=="")
{
user.focus();
Show(user_text);
}
}
</script>

<td width="27%">用户名:</td>
<td width="73%"><input name="user" type="text" id="user" onblur="Hide(user_text)">
*<span id="user_text" style="display:none">请输入用户名</span></td>

这样当用户名为空的时候就会在用户名右边出现提示了,其他项可同样按这种方式添加提示(还可添加多项提示按条件显示)。