我的代码:
<?php include ($_SERVER['DOCUMENT_ROOT'].'/functions/functions.php');?>
<div id="hasJavaScript">
<form name="signup">
<label>Username</label> <input type="text" name="user_temp" size=32 maxlength=32><span>alphanumeric, no spaces</span><br>
<label>Type password</label> <input type="password" name="pass_temp1" size=32 maxlength=32><span>alphanumeric, 8-12 long</span><br>
<label>Retype password</label> <input type="password" name="pass_temp2" size=32 maxlength=32><br>
<label>Email</label> <input type="text" name="email_temp" size=32 maxlength=32><br>
<label> What is: </label><?php $captchaArray = myCaptcha(); echo $captchaArray['equation'];?><br>
<label>Answer</label><input type="text" name="answer1">
<input onClick="passResponse(); return false;" type="submit" name="submitbtn" value="Signup Now">
</form>
<form action="/action/signup-action.php" METHOD="POST" name="hform">
<input type="hidden" name="sSecureUser">
<input type="hidden" name="sSecurePass1">
<input type="hidden" name="sSecurePass2">
<input type="hidden" name="secureEmail">
<input type="hidden" name="answer2">
<input type="hidden" name="checker" value=".<?php echo $captchaArray['answer'];?> .">
</form>
</div>
<noscript>
<div id="noscript">
<form method="POST" action="/action/signup-action.php" name="signup">
<label>Username</label> <input type="text" name="sNakedUser"><span>alphanumeric, no spaces</span><br>
<label>Type password</label> <input type="password" name="sNakedPass1"><span>alphanumeric, 8-12 long</span><br>
<label>Retype password</label> <input type="password" name="sNakedPass2"><br>
<label>Email</label> <input type="text" name="nakedEmail"><br>
<input onClick="passResponse(); return false;" type="submit" name="submitbtn" value="Signup Now">
</form>
</div>
</noscript>
<title>Sign Up Form</title>
<script language="javascript" src="/js/md5.js"></script>
<script language="javascript">
<!--
document.getElementById('hasJavaScript').style.display = 'block';
function passResponse() {
document.hform.sSecureUser.value = MD5(document.signup.user_temp.value);
document.hform.sSecurePass1.value = MD5(document.signup.pass_temp1.value);
document.signup.pass_temp1.value = "";
document.hform.sSecurePass2.value = MD5(document.signup.pass_temp2.value);
document.signup.pass_temp2.value = "";
document.hform.secureEmail.value = MD5(document.signup.email_temp.value);
document.hform.answer2.value = document.signup.answer1.value;
document.signup.answer1.value = "";
document.hform.submit();
}
// -->
</script>
我的问题:
代码工作正常,直到我添加:
<label> What is: </label><?php $captchaArray = myCaptcha(); echo $captchaArray['equation'];?><br>
<label>Answer</label><input type="text" name="answer">
<input type="hidden" name="answer">
<input type="hidden" name="checker" value=".<?php echo $captchaArray['answer'];?> .">
document.hform.answer2.value = document.signup.answer1.value;
document.signup.answer1.value = "";
...现在,即使我删除了这些行,我也会收到此错误:“TypeError:document.hform.sSecureUser is undefined”
我的网址在中断时返回:
http://localhost/?user_temp=aaa&pass_temp1=aaa&pass_temp2=aaa&email_temp=aaa&answer1=1&submitbtn=Signup+Now