<div class="codetitle"> <span><a style="CURSOR: pointer" data="79764" class="copybut" id="copybut79764" onclick="doCopy('code79764')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code79764"> <br> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8">> <br><title>使用者註冊</title> <br> <br><!-- <BR>function MyForm(){ <BR>msg.innerHTML="debug::in function"; <BR>var 使用者名稱= document.form1.username.value; <BR>var msg = document.getElementById("msg"); <BR>if(username.length==0){ <BR>msg.innerHTML="[ 提示:使用者名稱不能為空!]"; <BR> document.form1.username.focus(); <BR>回傳錯誤; <BR>} <BR>var pass = document.form1.password.value; <BR>if(pass.length==0){ <BR> msg.innerHTML="[ 提示:密碼不能為空!]"; <BR>document.form1.password.focus(); <BR>回傳錯誤; <BR>} <BR>var pass1 = document.form1.password1 .value; <BR>if(pass1.length==0){ <BR>msg.innerHTML="[ 提示:確認密碼不能為空!]"; <BR>document.form1.password1.focus(); <BR>回傳錯誤; <BR>} <BR>if(pass1!=pass){ <BR>msg.innerHTML="[ 提示:您兩次輸入的密碼不一致!]"; <BR>document.form1.passwood .focus(); <BR>回傳錯誤; <BR>} <BR>var mail = document.form1.mail.value; <BR>if(mail.length==0){ <BR>msg.innerHTML=" [ 提示:E_mail 不能為空! ]"; <BR>document.form1.mail.focus(); <BR>回傳錯誤; <BR>} <BR>var i = form1.mail.value.indexOf("@"); <BR>var j = form1.mail.value.indexOf("."); <BR>if((i<0)||(j<0)||(i-j>0)) <BR>{ <BR>msg.innerHTML= "[ 提示:您輸入的電子郵件格式不正確,請正確輸入]"; <BR>document.form1.mail.focus(); <BR>回傳錯誤; <BR>} <BR>msg.innerHTML=" "; <BR>回傳真; <BR>} <BR>--> <br>腳本> <br>頭> <br> <br><form id="form1" name="form1" method="post" action="" onsubmit="return MyForm()"> <br> <br><tr> <br><td colspan="2"><divalign>使用者註冊<br>></divalign></td> <br> </tr> <br><tr> <br><td colspan="2" align="center" bordercolor="">bgcolor=""> <br><font color="red"> <span id="msg">${error}</span> 字體> <br></font> </td> <br> </tr> <br><tr> <br><td width="71">使用者名稱:</td> <br><td width="286"> <br> <br> </td> </tr> <br>*(必填) <br> <br><tr> <br><td>使用者密碼:</td> <br> <br> <br>標籤> <br>*(必填) <br> </tr> <br><tr> <br><td>重複密碼:</td> <br><td> <br> <br>標籤> <br>*(必填)</td> <br> </tr> <br><tr> <br><td>電子郵件:</td> <br><td> <br> <br>標籤> <br>*(必填)</td> <br> </tr> <br><tr> <br><td>電話:</td> <br><td> <br> <br> </td> <br> </tr> <br><tr> <br><td>QQ:</td> <br><td> <br> <br> </td> <br> </tr> <br><tr> <br><td colspan="2"> <br><divalign> <br><input type="submit" name="Submit" value="註冊"> <br><input type="reset" name="Submit2" value="重置"> <br> <br></divalign> </td> <br> </tr> <br>表> <br>表格> <br>身體> <br> <br> </form> </div>