/    Sign up×
Community /Pin to ProfileBookmark

chosing between two URL’s

I was asked to find a way to make a choice between 2 URL’s.
I need help with figuring out how to receive the zip code in a text box then and a submit button. After normal validation I was asked to:
if (zipCode>=90000) && (zipCode<=93600)
go to URL1
else
go to URL2

This seemed so EASY or so I told my boss, but I have been spending too much time trying to get it. I have resorted to asking for help online.

I have been working as a web developer for about 3 months now and I know that there are ways to find everything you need on the web, and that will come with more experience I hope! I am wondering if this is unethical to ask for help, I have not had a lot of time to look around this forum to see the type of posts so if this is wrong of me I apologize.

Thanks for the help

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroAug 04.2003 — Try it like this:

&lt;script type="text/javascript"&gt;
function verify(frm) {
zipcode = frm.zipcode.value;
if (zipcode &gt;= 90000 &amp;&amp; zipcode &lt;= 93600) {
window.location.href = "http://www.webdevfaqs.com";
}
else {
window.location.href = "http://www.w3c.org";
}
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="myform"&gt;
&lt;input type="text" name="zipcode"&gt;
&lt;input type="button" value="Submit" onclick="verify(this.form);"&gt;
&lt;/form&gt;
Copy linkTweet thisAlerts:
@padawangeekauthorAug 04.2003 — thanks,

I guess I forgot the href because i tryed: window.location="http://www.blahblahblah

So I guess it was good to ask, you responded very quickly. Thanks
Copy linkTweet thisAlerts:
@pyroAug 04.2003 — Actually, that would work fine. Your problem was with the if command. You had:

if (zipCode>=90000) && (zipCode<=93600)

but you needed:

if (zipCode>=90000 && zipCode<=93600)
Copy linkTweet thisAlerts:
@padawangeekauthorAug 05.2003 — Again, thanks Pyro! This is an ongoing learning process and sometimes I guess you forget the little things. I didn't even notice that:o
Copy linkTweet thisAlerts:
@pyroAug 05.2003 — No problem... ?
×

Success!

Help @padawangeek 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.16,
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,
)...