My Optin form doesn't work in Internet Explorer, but works fine in Firefox.
Posted
by Allen
on Stack Overflow
See other posts from Stack Overflow
or by Allen
Published on 2010-05-25T23:54:29Z
Indexed on
2010/05/26
0:01 UTC
Read the original article
Hit count: 272
JavaScript
|form
I have the following code for my optin form:
<script language="JavaScript">
function checkSub(){
if (document.signup.email.value.indexOf('@', 0) == -1) {
alert("Please fill in your valid Email address.\nYour email should be in the following format: [email protected]");
document.signup.email.focus();
return false}
else if (!document.signup.terms.checked) {
alert("You must read and agree to the terms");
document.signup.terms.focus();
return false}
else {
switch(document.signup.extra1.value) {
case "Platinum":
answer = confirm("By clicking OK you confirm that you have\nalready entered
the World Cup Giveaway\nas a Platinum upgrade contributor.\n\nIf you have
not yet entered the giveaway\nclick Cancel.\n\nYou can enter using the
link at the\nbottom of the page.\n\nIf you have already entered the
giveaway\nusing a link other than my invitation link\nyou are not
eligible for this offer.");
if (!answer) { return false}
break;
case "Gold":
answer = confirm("By clicking OK you confirm that you have\nalready entered
the World Cup Giveaway\nas a Gold upgrade contributor.\n\nIf you have not
yet entered the giveaway\nclick Cancel.\n\nYou can enter using the link
at the\nbottom of the page. \n\nIf you have already entered the
giveaway\nusing a link other than my invitation link\nyou are not eligible
for this offer.");
if (!answer) { return false}
break;
default:
alert("You must sign up as a contributor to the \nWorld Cup Giveaway to take
advantage of \nthis offer.\n\nPlease click the link at the bottom of this
\npage or at the blog post mentioned below \nto sign up.\n\nIf you have
already signed up using \nthis link, please select the upgrade level\nyou
chose on signup or select \"Free\" if \nyou signed up as a free
contributor.\n\nIf you have already entered the giveaway\nusing a link other
than my invitation link\nyou are not eligible for this offer.\n\nNote: This
page may not function properly\nif viewed in languages other than English.");
return false}
}
}
</script>
<form action="http://ebizac.com/ar/optin.php" method="post" name="signup" onsubmit="return checkSub()">
<input type=hidden name="action" value="addlead">
<input type=hidden name="member" value="2315">
<input type=hidden name="auto" value="7584">
<input type=hidden name="thankyou" value="http://plr.forinternetnewbies.com/Offer1">
<input type=hidden name="resubsetting" value="Y">
<input type=hidden name="resubredirect" value="">
<input type=hidden name="invalid_redirect" value="">
<div style="padding:0 0 0 10px;">
<table border=0 cellspacing=0 cellpadding=2><tr><td class="label"><font size="2" face="arial, verdana">Name:</font></td><td><input type=text size=20 name="fname"></td></tr>
<tr><td class="label" width="150"><font size="2" face="arial, verdana">Email address:</font></span></td><td><input type=text size=20 name="email"></td></tr>
<tr><td class="label"><font size="2" face="arial, verdana">Upgrade Level:</font></td><td><select size=1 name="extra1"><option>Haven't Joined Yet</option><option>Platinum</option><option>Gold</option><option>Silver</option><option>Free</option></td></tr>
<tr><td></td><td align=center><input type="checkbox" name="terms" value="agree">I agree to the terms as described on the <a href="http://short9.com/blog0522-sp" target="_blank">blog post</a> </td></tr>
<tr><td></td><td align=center><input type="submit" value="Contribute Now"></td></tr></table></div></form>
Everything does what I expect in Firefox, but in Internet Explorer the switch statement always goes to the default case. I tested with an extra alert(signup.extra1.value) in the default case and it shows an empty string.
What could be the problem here?
© Stack Overflow or respective owner