第一種:
復(fù)制代碼 代碼如下:
<script type="text/javascript">
function check(form) {
if(form.userId.value=='') {
alert("請(qǐng)輸入用戶(hù)帳號(hào)!");
form.userId.focus();
return false;
}
if(form.password.value==''){
alert("請(qǐng)輸入登錄密碼!");
form.password.focus();
return false;
}
return true;
}
</script>
<form action="login.do?act=login" method="post">
用戶(hù)帳號(hào)
<input type=text size="18" value="" >
<br>
登錄密碼
<input type="password" size="19" value=""/>
<input type=submit value="登陸">
</form>
復(fù)制代碼 代碼如下:
<script type="text/javascript">
function check(form) {
if(form.userId.value=='') {
alert("請(qǐng)輸入用戶(hù)帳號(hào)!");
form.userId.focus();
return false;
}
if(form.password.value==''){
alert("請(qǐng)輸入登錄密碼!");
form.password.focus();
return false;
}
return true;
}
</script>
<form action="login.do?act=login" method="post" onsubmit="return check(this)">
用戶(hù)帳號(hào)
<input type=text size="18" value="" >
<br>
登錄密碼
<input type="password" size="19" value=""/>
<input type=submit value="登陸">
</form>
復(fù)制代碼 代碼如下:
<script type="text/javascript">
function check(form) {
if(form.userId.value=='') {
alert("請(qǐng)輸入用戶(hù)帳號(hào)!");
form.userId.focus();
return false;
}
if(form.password.value==''){
alert("請(qǐng)輸入登錄密碼!");
form.password.focus();
return false;
}
document.myform.submit();
}
</script>
<form action="login.do?act=login" method="post">
用戶(hù)帳號(hào)
<input type=text size="18" value="" >
<br>
登錄密碼
<input type="password" size="19" value=""/>
<input type=button value="登陸">
</form>
新聞熱點(diǎn)
疑難解答
圖片精選