Trending News
Promoted
Javascript 問題
我想請問有冇人識得用javascript寫帳號申請
如當id name 多於12字完
email沒有@
password少於n個字完就出現錯誤等
2 Answers
Rating
- HUNGLv 71 decade agoFavorite Answer
下面是如果沒有輸入 password 或 username 的時候就出現錯誤。你的問題也類似,只需要 call 一個 check 長度的 function 如 Len(xx)<12,就可以了。
<SCRIPT Language = javascript>
<!-- below function is used for checking the input status
function datacheck()
{
if(frmLogin.ID.value == "")
{
window.alert("Please input a student ID!");
document.frmLogin.elements(0).focus();
return;
}
if(frmLogin.Password.value == "")
{
window.alert("Please input a password!");
document.frmLogin.elements(1).focus();
return;
}
frmLogin.submit();
}
-->
</SCRIPT>
Still have questions? Get your answers by asking now.