Web_Design 板


LINE

不好意思 我又来了... 想再请问一个JavaScript 注册网页的问题 一般来说 在填注册网页的时候 只要有一个必填选项没填 就会出现警告讯息 但我RUN出来的结果 只有第一个选项没有填的时候 才会有错误讯息 其他的选项没填就不会出现错误讯息 请问是什麽问题呢...谢谢...^^" CODE如下... <%@ page contentType="text/html; charset=big5" language="java" import="java.sql.*" errorPage="" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>无标题文件</title> </head> <script language="javascript"> function check() { if (document.form1.id.value == "") { window.alert("未输入帐号!"); return false; } if (document.form1.pwd.value == "") { window.alert("未输入密码!"); return false; } if (document.form1.cpwd.value == "") { window.alert("未输入确认密码!"); return false; } if (document.form1.email.value == "") { window.alert("未输入email!"); return false; } if (document.form1.tel.value == "") { window.alert("未输入电话!"); return false; } if (!(document.form1.sex[0].checked) && !(document.form1.sex[1].checked)) { window.alert("未选择性别!"); return false; } if (document.form1.city.value=="0") { window.alert("未选择居住地!"); return false; } return confirm("确定要送出吗?"); } </script> <body bgcolor="#DDEBEC"> <div align="center"> <p><strong><font color="#333366">请填写会员注册资料 </font></strong></p> <form name="form1" method="post" action="list.jsp"> <table width="54%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td><div align="left"><font color="#333366"><strong>ID: </strong></font></div></td> <td><font color="#333366"> <input name="id" type="text" id="id" size="8" maxlength="6"> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Password: </strong></font></div></td> <td><font color="#333366"> <input name="pwd" type="password" id="pwd" size="8" maxlength="6"> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Check Password: </strong></font></div></td> <td><font color="#333366"> <input name="cpwd" type="password" id="cpwd" size="8" maxlength="6"> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>E-mail: </strong></font></div></td> <td><font color="#333366"> <input name="email" type="text" id="email"> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Tel:</strong></font></div></td> <td><font color="#333366"> <input name="tel" type="text" id="tel"> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Sex:</strong></font></div></td> <td><font color="#333366"> <input type="radio" name="sex" value="Male"> Male <input type="radio" name="sex" value="Female"> Female</font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>City: </strong></font></div></td> <td><font color="#333366"> <select name="city" id="city" > <option selected value="0">请选择地区</option> <option value="台北">台北</option> <option value="新竹">新竹</option> <option value="台中">台中</option> <option value="彰化">彰化</option> <option value="嘉义">嘉义</option> <option value="台南">台南</option> <option value="高雄">高雄</option> <option value="屏东">屏东</option> <option value="台东">台东</option> <option value="花莲">花莲</option> <option value="宜兰">宜兰</option> <option value="基隆">基隆</option> </select> </font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Info: </strong></font></div></td> <td><font color="#333366"> <input name="网路" type="checkbox" id="checkbox1" value="网路"> 网路 <input type="checkbox" name="checkbox2" value="电视"> 电视 <input type="checkbox" name="checkbox3" value="杂志"> 杂志 <input type="checkbox" name="checkbox4" value="报纸"> 报纸 <input type="checkbox" name="checkbox6" value="亲友介绍"> 亲友介绍 <input type="checkbox" name="checkbox5" value="其他"> 其他</font></td> </tr> <tr> <td><div align="left"><font color="#333366"><strong>Comment:</strong></font></div></td> <td><font color="#333366"> <textarea name="comment" cols="50" rows="5" id="commend"></textarea> </font></td> </tr> </table> <p align="center"> <input type="submit" name="Submit" value="Submit" onClick="check()"> <input type="reset" name="Submit2" value="Reset"> </p> </form> <p>&nbsp;</p> </div> </body> </html> --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.62.158.73
1F:推 blackbing:Submit的按钮onclick属性请改成 "return check()" 08/21 04:33







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Gossiping站内搜寻

TOP