SEO | Link Popularity | Search Engine Consulting | SEO Tutorial | SEO Tools | SEO Forum
Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1  
Old 04-14-2005, 03:54 PM
Kathy's Avatar
Kathy Kathy is offline
SEO Junior and a half
 
Join Date: Aug 2004
Posts: 40 Kathy is on a distinguished road
Modify script from checkbox to pulldown.

Hi All,

I have a javascript that will modify the URL of a form on-the-fly based on a checkbox or radio button.

I am wanting to modify it to change the URL based on a pull down menu instead.

I do not know much about JavaScript. Does anyone know if there is an inherent reason this will not work.

Also any pointers would be greatly appreciated!

This is the code I have now.

Code:
<script type="text/javascript" language="JavaScript">
<!-- 
function ActionDeterminator()
{
if(document.myform.reason[0].checked == true) {
   document.myform.action = '/cgi-bin/mf1.cgi';
   }
if(document.myform.reason[1].checked == true) {
   document.myform.action = '/cgi-bin/mf2.cgi';
   document.myform.method = 'get';
   }
if(document.myform.reason[2].checked == true) {
   document.myform.action = 'http://yahoo.com';
   }
return true;
}
// -->
</script>

<form name="myform" method="post" action="/cgi-bin/mf.cgi">
Name: <input type="text" name="a name" size="22"><br>
Email: <input type="text" name="email"size="22"><br>
Reason:<br>
<input type="radio" name="reason">I have a Hot Tip!<br>
<input type="radio" name="reason">I saw a Cool Site!<br>
<input type="radio" name="reason">Get me outta here!<br>
Type comment here:<br>
<textarea name="comments" cols="27" rows="6">
</textarea><br><br>
<input 
   type="submit" 
   value="Send It!" 
   onClick="return ActionDeterminator();">
</form>
__________________
colorado lawyer | denver lawyer
Reply With Quote
  #2  
Old 05-12-2005, 08:47 AM
SEO Aaron SEO Aaron is offline
SEO Guy Web dev team
 
Join Date: Feb 2005
Posts: 693 SEO Aaron is on a distinguished road
Code:
<script type="text/javascript" language="JavaScript">
<!-- 
function ActionDeterminator()
{
choice = document.myform.pizza.selectedIndex
if(document.myform.pizza.options[choice].value == "HotTip") {
   document.myform.action = '/cgi-bin/mf1.cgi';
   }
if(document.myform.pizza.options[choice].value == "CoolSite") {
   document.myform.action = '/cgi-bin/mf2.cgi';
   document.myform.method = 'get';
   }
if(document.myform.pizza.options[choice].value == "outaHere") {
   document.myform.action = 'http://yahoo.com';
   }
return true;
}
// -->
</script>

<form name="myform" method="post" action="/cgi-bin/mf.cgi">
Name: <input type="text" name="a name" size="22"><br>
Email: <input type="text" name="email"size="22"><br>
Reason:<br>
<select name="pizza">
<option name="reason" value="HotTip">I have a Hot Tip!</option>
<option name="reason" value="CoolSite">I saw a Cool Site!</option>
<option name="reason" value="outaHere">Get me outta here!</option>
</select>
<br>Type comment here:<br>
<textarea name="comments" cols="27" rows="6">
</textarea><br><br>
<input 
   type="submit" 
   value="Send It!" 
   onClick="return ActionDeterminator();">
</form>



This code makes a drop down box version. :-)

Aaron
Reply With Quote
  #3  
Old 03-11-2007, 06:16 PM
Liyrhsara Liyrhsara is offline
SEO Junior
 
Join Date: Mar 2007
Posts: 1 Liyrhsara is on a distinguished road
Post Software Download

Reply With Quote
Reply


Thread Tools
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
Forum Jump


Login/Register
User Name
Password
Remember Me?

Forum Links
Forum Home
SEO Forum
Internet Marketing Forum
Web Design Forum
Web Hosting Forum
Programming Forum
SEO Chat

Quick Links
Forum Home
New Posts
Mark Forums Read
Open Buddy List
User Control Panel
Edit Avatar
Edit Profile
Edit Options
Miscellaneous
Subscribed Threads
My Profile

Search Forums

Advanced Search
All times are GMT -8. The time now is 01:32 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.