HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 13th, 1999, 02:28 PM
Kimberly
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
HI, we are trying to create a form where if you enter a certain country, say candada it takes you to one page when you submit the form..and if you pick U.S.A. then it takes you to another form ...Is this going to have to involve java, or is there any way to use a variables within html?

Reply With Quote
  #2  
Old October 15th, 1999, 08:23 PM
scollo
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi Kimberly,

It's a little complicated, but try this:

<HTML>
<HEAD>
<SCRIPT LANGUAGE='javascript'>
function direct (frm) {
&nbsp;switch (frm.Country.selectedIndex) {
&nbsp;&nbsp;case 0:
&nbsp;&nbsp;&nbsp;frm.action="canada.html";
&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;case 1:
&nbsp;&nbsp;&nbsp;frm.action="us.html";
&nbsp;&nbsp;&nbsp;break;
&nbsp;}
&nbsp;return true;
}
</SCRIPT>

</HEAD>
<BODY>
<FORM onSubmit="return direct(this);">
<SELECT NAME="Country">
&nbsp;<OPTION>Canada</OPTION>
&nbsp;<OPTION>United States</OPTION>
</SELECT>
<INPUT TYPE=submit VALUE="Enter">
</FORM>
</BODY>
</HTML>

Let me know how this goes.

-- Christopher

Reply With Quote
  #3  
Old October 15th, 1999, 08:38 PM
scollo
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Incidentally, if you want the page to change as soon as the user select a country (without having to click "Submit"), the code would look like this:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript">

function direct (slct) {
&nbsp;&nbsp;switch (slct.selectedIndex) {
&nbsp;&nbsp;&nbsp;&nbsp;case 0:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.document.location.href="canada.html";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;&nbsp;case 1:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.document.location.href="us.html";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;}
}

</SCRIPT>
</HEAD>

<BODY>
<FORM>
&nbsp;&nbsp;<SELECT NAME="Country" onChange="direct(this);">
&nbsp;&nbsp;&nbsp;&nbsp;<OPTION>Canada</OPTION>
&nbsp;&nbsp;&nbsp;&nbsp;<OPTION>United States</OPTION>
&nbsp;&nbsp;</SELECT>
</FORM>
</BODY>
</HTML>

Naturally, replace canada.html with the page that you want for Canada and replace us.html with the page that you want for the U.S.

-- Christopher

(I hope this works)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > forms--redirecting to different pages

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap