|
-
May 25th, 2005, 09:54 AM
#1
Thread Starter
Hyperactive Member
Very simple javascript...
Hello,
I have a dropdown name poems in which several poems are listed. And i have a href link now what i am trying to do is whenever the href link is clicked the value of the dropdown should get added to href link. For example:
link is: eg.php?poem=
upon clicking it should become eg.php?poem=x
where x is the value of the selected dropdown option. How can i do this ?
Thanks.
Tapan Bhanot,
CEO, Avis Software.
Website: www.avissoftware.com
-
May 25th, 2005, 10:07 AM
#2
Re: Very simple javascript...
 Originally Posted by AvisSoft
Hello,
I have a dropdown name poems in which several poems are listed. And i have a href link now what i am trying to do is whenever the href link is clicked the value of the dropdown should get added to href link. For example:
link is: eg.php?poem=
upon clicking it should become eg.php?poem=x
where x is the value of the selected dropdown option. How can i do this ?
Thanks.
Try this:
Code:
var MyDropdown = document.getElementById("Your Dropdown Menus ID Here");
var TheString = MyDropdown.options[MyDropdown.selectedIndex].text;
window.location.href = New String("eg.php?poem=x" + TheString);
Cheers,
RyanJ
-
May 25th, 2005, 10:53 AM
#3
Thread Starter
Hyperactive Member
Re: Very simple javascript...
Hi,
Thanks for the solutons but i need to get solution like this in just 1 line:
var pid = document.f1.poemid.selectedIndex; (this is not working)
Thanks
Tapan Bhanot,
CEO, Avis Software.
Website: www.avissoftware.com
-
May 25th, 2005, 10:58 AM
#4
Re: Very simple javascript...
 Originally Posted by AvisSoft
Hi,
Thanks for the solutons but i need to get solution like this in just 1 line:
var pid = document.f1.poemid.selectedIndex; (this is not working)
Thanks
You can put the code I gave you in one line:
Code:
var TheString = document.f1.poemid.options[document.f1.poemid.selectedIndex].value;
window.location.href = New String("eg.php?poem=x" + TheString);
Cheers,
RyanJ
-
May 25th, 2005, 11:54 AM
#5
Thread Starter
Hyperactive Member
Re: Very simple javascript...
Hi,
Thanks it helped.
Thanks again.
Tapan Bhanot,
CEO, Avis Software.
Website: www.avissoftware.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|