I am trying to create a redirect after visitor inputs an access code for a promotional campaign. It works fine in OS X Chrome & Safari and Windows Chrome, but not OS X Firefox or Windows IE & Firefox.
Website is located at https://www.preciousmetals.com/offer12
I have this script in the head…
<script type="text/javascript">
function checkCode() {
if (this.password.value.toLowerCase() == 'AAL1012'.toLowerCase()) {
window.location='https://www.preciousmetals.com/special-offer-12.html';
}
else {
alert('Wrong Access Code!');
}
return false;
}
</script>
And this in the body…
<form onsubmit="return checkCode()">
<h3 style="text-align: center;">
Enter Access Code To Proceed
</h3>
<div style="text-align: center;">
<input type="password" id="password" />
<input type="submit" value="Proceed" />
</div>
</form>
You really should not validate a password with javascript like that. It's a big security issue.
If you want to do it anyway try this:
<h3 style="text-align: center;">
Enter Access Code To Proceed
</h3>
<div style="text-align: center;">
<input type="password" id="password" />
<button onClick="checkCode();return false;" type="button">Proceed</button>
</div>
Notice that I removed the form and replaced the button code
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.