/    Sign up×
Community /Pin to ProfileBookmark

problem with internet explorer

hi guys
i have registration page you know name email country ….
but i found in the internet javascript msgs to prompt people who register if there any error like valid email and Full all fields ..
this is the code
Code:

<script type=”text/javascript”>
function setFocus(aField) {
document.forms[0][aField].focus();
}

function isAnEmailAddress(aTextField) {

if (document.forms[0][aTextField].value.length<5) {
return false;
}
else if (document.forms[0][aTextField].value.indexOf(“@”) < 1) {
return false;
}
else if (document.forms[0][aTextField].value.length –
document.forms[0][aTextField].value.indexOf(“@”) < 4) {
return false;
}
else { return true; }
}

function isEmpty(aTextField) {
if ((document.forms[0][aTextField].value.length==0) ||
(document.forms[0][aTextField].value==null)) {
return true;
}
else { return false; }
}
function validate() {

if (isEmpty(“name”)) {
alert(“Please fill your name.”);
setFocus(“name”);
return false;
}
if (isEmpty(“Country”)) {
alert(“Please fill your Country.”);
setFocus(“con”);
return false;
}
if (!isAnEmailAddress(“email”)) {
alert(” The entered email address is invalid.”);
setFocus(“email”);
return false;
}
return true;

}
</script>

i tried this in firefox and it’s working 100% but in internet explorer it’s prompt me to fill my country all the time
i tried more than country and i told my friends to do
all have same problem
so who know what to do ?
thanks for all

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@DokAug 07.2007 — Is country an <input> or a <select> tag?
Copy linkTweet thisAlerts:
@janimauthorAug 07.2007 — <select><option>[code]<select name="con" style="width: 198px">
<option>Afghanistan</option>
<option>Albania</option>
<option>Algeria</option>
[/codeE]etc..
Copy linkTweet thisAlerts:
@mrhooAug 07.2007 — Either set each option's value, or test for the optionelement.text values.
×

Success!

Help @janim spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...