//客户端对用户输入数据校验
//如果输入的内容不满足,则不提交,并且焦点自动跳到该位置。
//比发送以后在服务器端校验数据要好用的多!
脚本代码:
<script language="javascript">
<!--
function juge(theform)
{
if (theform.title.value == "")
{
alert("请输入标题!");
theform.title.focus();
return (false);
}
if (theform.detail.value == "")
{
alert("请输入内容!");
theform.detail.focus();
return (false);
}
if (theform.name.value == "")
{
alert("请输入作者!");
theform.name.focus();
return (false);
}
if (theform.email.value == "")
{
alert("请输入信箱!");
theform.email.focus();
return (false);
}
}
-->
</script>
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器