[英]javascript redirect form working in Chrome/Safari, but nor Firefox/IE
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.
它可以在OS X Chrome和Safari和Windows Chrome中正常运行,但不能在OS X Firefox或Windows IE&Firefox中运行。
Website is located at https://www.preciousmetals.com/offer12 网站位于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. 您确实不应该使用javascript验证密码。 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 请注意,我删除了表单并替换了按钮代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.