/    Sign up×
Community /Pin to ProfileBookmark

Hello,

I’m trying to create a text field on my site, and I want that when a user enter his zip code, and then press enter, he will be directed to another website.

But it doesn’t work:

<input type=”text” name=”zipcode” value=”Enter your Zip Code” id=”zip” maxlength=”20″ onclick=”window.location.href=’http://second.site.com‘”>

Thanks
Steve

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@StelarOct 21.2010 — <form>

<input type="text" name="zipcode" value="Enter your Zip Code" id="zip" maxlength="20" onclick="window.location.href='http://second.site.com'">

<input type="submit">

</form>
Copy linkTweet thisAlerts:
@jcoc611Oct 22.2010 — Try using this, if you just use the [I]onclick[/I] JavaScript event your data wont be sent to the new webpage.
[CODE]<form name="test" action="http:/second.site.com" method="get">
<input type="text" name="zipcode" value="Enter your Zip Code" id="zip" maxlength="20" />
<input type="submit"/>
</form>
[/CODE]
×

Success!

Help @SteveJo 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.19,
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,
)...