本文介绍了ASP脚本中的必填字段验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要帮助才能在ASP脚本中执行所需的字段验证.
例如:
用户名..........
密码..........
在这种情况下,如果用户名和密码为blanc,我应该显示错误消息
输入您的用户名"和输入您的密码".
由于使用ASP脚本,因此语法非常困难.
请提供建议.
Hi all,
I need help to perform required field validations in ASP script.
Eg:
Username ..........
Password ..........
In this , if the username and password are blanc ,I should display the error messages
"Enter your username" and "Enter yor password".
Since ASP script, the syntax are quite difficult .
Kindly provide suggestions.
推荐答案
function validateForm()
{
var x=document.forms["myForm"]["username"].value;
var y=document.forms["myForm"]["password"].value;
if (x==null || x=="")
{
alert("Enter Username");
return false;
}
if (y==null || y=="")
{
alert("Enter Password");
return false;
}
}
这篇关于ASP脚本中的必填字段验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!