|
| |
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
adding a second drop down list - 10/23/2005 20:51:46
Hello I was able to add one drop down list to my page but I would like to add a few others. But it keeps giving me an error stating the form is already used. any help would be great. I'm using 2002 FP Also these drop downs are used with out a "go" button and will only link you to onther page. Thanks, john
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/24/2005 16:10:38
Thanks for the welcome.. Ok this may help? The below code is what I have added and works great, however, the problem I'm having is I would like two drop down lists and not sure how to make it work with two. thanks for the help. John <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(form){ var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT> <center> <form name="form"> <select name="site" size=1 onChange="javascript:formHandler()"> <option value="">Go to... <!-- Option 1 -- To have the pull down menu go to your own pages, change the URL within the quotation marks and the link name. --> <!-- Option 2 -- You may remove or add entire lines to increase or decrease the number of links. --> <option value="http://www.yahoo.com">Yahoo <option value="http://geocities.yahoo.com/">GeoCities <option value="http://shopping.yahoo.com/">Yahoo! Shopping <option value="http://travel.yahoo.com/">Yahoo! Travel </select> </form> </center>
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/24/2005 16:29:10
Yes sorry about that another to the same form. here is my site and you can see on the left I made the first one now I would like to add the rest right under it. www.jtm311.com John
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/24/2005 16:40:57
Thanks womble. i thought it was that easy. This is where I start having problems. Do I add the whole srcip? If not what should I add? Thanks, John
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/24/2005 17:49:18
oK womble one step closer.. the second one shows up now.. but it does not change to the page list in the below? I added the below. John <SCRIPT LANGUAGE="JavaScript"> <!-- Begin c var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT> <center> <form name="formd2"> <select name="" size=1 onChange="javascript:formHandler()"> <option value="">Go to... <!-- Option 1 -- To have the pull down menu go to your own pages, change the URL within the quotation marks and the link name. --> <!-- Option 2 -- You may remove or add entire lines to increase or decrease the number of links. --> <option value="http://www.yahoo.com">Yahoo </select> </form> </center>
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/24/2005 18:32:29
Did not see that extra d ,,lol but what it does now after fixing it. It only goes to whatever the last page I selected from the other drop down. John
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: adding a second drop down list - 10/24/2005 18:52:52
quote:
You'll need to give the second form a different name and in the js for the second form, change the name in the script on this line: function formHandler(form) to whatever the name of the second form is. that shouldnt be necessary. a function is designed to be used repeatedly - as often as it is "called". in this case, the function formHandler is "called" with this: onChange="javascript:formHandler()"> when the function was defined within the <script> tag, the author defined it as quote:
function formHandler(form) but the use of (form) could have just as easily been x since it merely represents whatever parameter is passed from the call. in other words, it could have (and maybe should have for reasons i will discuss) looked like this: quote:
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(x){ var URL = document.form.site.options[document.x.site.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT> what happens is that the call passes the form values a a parameter. the x respersents whatever is passed. is thatmaking any sense? the point is that the script function only needs to be defined one time - not for each time it is used.
_____________________________
Dan
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/25/2005 19:16:31
Ok guys don't give up on me now we are to close to making it work??? John
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: adding a second drop down list - 10/26/2005 8:01:50
i tested that and it worked for me
_____________________________
Dan
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/26/2005 10:44:34
It is the second drop down that does not work... But I received an email back from Java they said the problem is I need a statment for each time it is called. They gave me the following fix, I will try it tonight Thanks for the help John <html> <head> function formHandler1(){ var URL = document.form1.site1.options[document.form1.site1.selectedIndex].value; window.location.href = URL; } function formHandler2(){ var URL = document.form2.site2.options[document.form2.site2.selectedIndex].value; window.location.href = URL; } </SCRIPT> </head>
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: adding a second drop down list - 10/26/2005 11:14:03
i guess i was wrong
_____________________________
Dan
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/26/2005 13:41:07
Thank Dan not sure yet thanks for the help... John
|
|
|
|
jtm311
Posts: 21 Joined: 10/23/2005 Status: offline
|
RE: adding a second drop down list - 10/27/2005 19:41:21
Hello just wanted to follow-up I got it to work using the following. Just thought you would like to know. here is what it looks like. thanks again, John <!-- Begin function formHandler1(){ var URL = document.form.site1.options[document.form.site1.selectedIndex].value; window.location.href = URL; } function formHandler2(){ var URL = document.form.site2.options[document.form.site2.selectedIndex].value; window.location.href = URL; } function formHandler3(){ var URL = document.form.site3.options[document.form.site3.selectedIndex].value; window.location.href = URL; } function formHandler4(){ var URL = document.form.site4.options[document.form.site4.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|