最简单的用户登录js验证程序
<script language="javascript">
<!--
function form1_onsubmit()
{
if(document.form1.keyword.value=="")
{
alert("请输入查询关键字!")
document.form1.keyword.focus()
return false
}
else if(document.form1.keyword.value=="请输入查询关键字")
{
alert("请输入查询关键字!")
document.form1.keyword.focus()
return false
}
else if(document.form1.sort.value=="")
{
alert("请选择分类!")
document.form1.sort.focus()
return false
}
}
-->
</script>
<form name="form1" method="post" action="search.asp" onsubmit="return form1_onsubmit()">
<td align="right" height="25" class="padding2"><input type="text" name="keyword" value="请输入查询关键字" onfocus="this.value='';" onblur="if(this.value==''){this.value='请输入查询关键字';this.style.color='#999999'}else{this.style.color='#000000'};" style="color:#999999;">
<select name="sort" size="1">
<option value="">请选择分类</option>
<option value="pic">图片素材</option>
<option value="template">模板下载</option>
<option value="free">空间域名</option>
<option value="build">网页制作</option>
<option value="effect">网页特效</option>
<option value="run">网站运营</option>
<option value="web">网址收录</option>
<option value="bbs">站长论坛</option>
</select>
<input type="submit" name="submit" value="查询" class="button"></td>
</form>
</tr>
</table>