當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
JS非空验证
代碼如下:
<!DOCTYPE html> <html><meta charset="UTF-8"><title></title><head><script language="javascript">function checklogin() {if((myform.user.value != "")) {if((myform.pwd.value != "")) {return true} else {alert("密碼不能為空");return false}} else {alert("用戶名不能為空");return false}}</script><title></title></head><body><form action="form.html" name="myform" method="post" onSubmit="return checklogin()"><input type="text" name="user" size="16"><br><input type="password" name="pwd" size="16"><input type="submit" value="登錄" name="sub_1"></form></body></html>
轉載于:https://www.cnblogs.com/sglq/p/7363112.html
總結
- 上一篇: RoHS、无铅制程、无卤 的基本介绍
- 下一篇: 智慧机场室内导航系统-采用蓝牙定位方案-