目前還在DEBUG~~
還不知道自己錯在那~~
用FIREBUG 有看到JAVASCRIPT 傳回值(TURE)後但不會再傳給FORM 的ACTION 目標~
以下貼上自己錯的HTML以做記錄
< -%@ page language="java" contentType="text/html; charset=BIG5"
pageEncoding="BIG5"%>
< -%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core"%>
< -!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< -html>
< -head>
< -meta http-equiv="Content-Type" content="text/html; charset=BIG5">
< -title>Member Regist Page< -/title>
< -style type="text/css">
< -!--
#apDiv1 {
position:absolute;
left:0px;
top:0px;
width:730px;
height:420px;
z-index:1;
background-image:url(images/01A.jpg);
background-repeat: no-repeat;
}
#elemName {
text-align: right;
}
#elem {
text-align: left;
}
#nameDiv {
background-color:#FF9933
}
#nicknameDiv {
background-color:#FF9933
}
#passwordDiv {
background-color:#FF9933
}
#titleDiv {
background-color:#FF9933
}
#emailDiv {
background-color:#FF9933
}
#mobleDiv {
background-color:#FF9933
}
#sexDiv {
background-color:#FF9933
}
#errMsgarea{
background-color:#FF0000
}
-->
< -/style>
< -script language="javascript">
function focusto(x){
document.forms[0].elements[x].focus();
}
function hidden_all()
{
nameDiv.style.display = 'none';
nicknameDiv.style.display = 'none';
passwordDiv.style.display = 'none';
titleDiv.style.display = 'none';
emailDiv.style.display = 'none';
mobleDiv.style.display = 'none';
sexDiv.style.display = 'none';
errMsgarea.style.display = 'none';
}
function show_me(obj)
{
hidden_all();
obj.style.display = 'block';
}
function verifyAddress(obj){
var email = obj;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(!flag){
return "notmail";
}
}
function verifymoble(obj){
var moble = obj;
var pattern = /^([0-9_-])/;
flag = pattern.test(moble);
if(!flag && moble.length != 10){
return "notmob";
}
}
function pageOnLoad(){
hidden_all();
}
function userCheck(){
var d=document;
var uf=uform;
hidden_all();
if(uf.m_name.value == ""){
show_me(nameDiv);
focusto(1);
return false;
}else if(uf.m_nickname.value ==""){
show_me(nicknameDiv);
focusto(2);
return false;
}else if(uf.m_password.value ==""){
show_me(passwordDiv);
focusto(3);
return false;
}else if(uf.m_title.value ==""){
show_me(titleDiv);
focusto(4);
return false;
}else if("notmail" == verifyAddress(uf.m_email.value)){
show_me(emailDiv);
focusto(5);
return false;
}else if("notmob" == verifymoble(uf.m_moble.value)){
show_me(mobleDiv);
focusto(7);
return false;
}else if(uf.m_sex.value == ""){
show_me(sexDiv);
focusto(8);
return false;
}
alert("OK");
return true;
}
< -/script>
< -/head>
< -body onLoad="pageOnLoad();" background="images/01A.jpg">
< -h2>歡迎您加入資訊安全的行列< -/h2>
< -div id="errMsgarea">${errorMsg}< -/div>
< -form name="uform" id="uform" method="post" action="/Norman_dev/addmember.jsp">
< -table width="100%" border="0">
< -tr>
< -td width="35%" align="right">
< -div align="right">帳號:< -/div>
< -/td>
< -td width="35%" align="left">< -input name="m_no" type="text"
id="m_no" size="20" maxlength="20" value="本欄由系統指定" disabled>< -/td>
< -td> < -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">姓名:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_name" type="text" id="m_name"
size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="nameDiv">姓名不可為空< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">暱稱:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_nickname" type="text"
id="m_nickname" size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="nicknameDiv">暱稱不可為空< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">密碼:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_password" type="password"
id="m_password" size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="passwordDiv">密碼不可為空< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">職稱:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_title" type="text" id="m_title"
size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="titleDiv">職稱不可為空< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">E-Mail:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_email" type="text" id="m_email"
size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="emailDiv">E-Mail不可為空或格式錯誤< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">公司:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_comp" type="text" id="m_comp"
size="20" maxlength="20">< -/div>
< -/td>
< -td> < -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">手機:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_moble" type="text" id="m_moble"
size="20" maxlength="20">< -/div>
< -/td>
< -td>
< -div id="mobleDiv">手機不可為空或格式錯誤< -/div>
< -/td>
< -/tr>
< -tr>
< -td>
< -div id="elemName">性別:< -/div>
< -/td>
< -td>
< -div id="elem">< -input name="m_sex" type="text" id="m_sex"
size="20" maxlength="1" value="F">< -/div>
< -/td>
< -td>
< -div id="sexDiv">性別不可為空< -/div>
男性:F,女性:M< -/td>
< -/tr>
< -/table>
< -input type="button" value="註冊" onClick="javascript:return userCheck();">
< -/form>
< -/body>
< -/html>
為了可以正常的發佈.. 所以把< 改成 < - 了
回覆刪除-input type="submit" value="註冊" onClick="javascript:return userCheck();">
回覆刪除submit才對...