javascript进行客户端数据的校验(1)CSSHTML教程
|
| 论文作者:佚名 论文来源:不详 论文发布时间:2006-6-20 0:47:20 论文发布人:chjchjchj |
减小字体
增大字体
//客户端对用户输入数据校验 //如果输入的内容不满足,则不提交,并且焦点自动跳到该位置。 //比发送以后在服务器端校验数据要好用的多!
脚本代码:
<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>
|
|
|
|
|
|
|
| ∷相关技术评论 |
(评论内容只代表网友观点,与本站立场无关!) [查看发表评论...] | |
|
|
| |
站内广告 |
| |
|
站内搜索 |
| |
栏目导航 |
| |
|
|
本月热门 |
| |
|
|
本日热门 |
| |
|
|
|