Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-27-2007, 12:23 PM   PM User | #1
CaptainB
Regular Coder

 
Join Date: Jun 2007
Posts: 805
Thanks: 123
Thanked 23 Times in 23 Posts
CaptainB is an unknown quantity at this point
URL in select menu

Hi.

I have following code:

Code:
<select name="Networksites">
<option selected="selected">Network Websites</option>
<option value="http://www.testsite.com">Testsite.com</option>
<option value="http://www.testsite2.com">Testsite 2.com</option>
</select>
I want to be able to navigate to the sites when I select them in the menu, however nothing happens when I select them.

What have I done wrong? I found an old thread here, and its code looked similiar.
CaptainB is offline   Reply With Quote
Old 10-27-2007, 12:32 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Code:
<select name="Networksites" onchange="window.location=this.value;">
This will do it partially, but I'm not whether it suits or not since you may have to check this.value.
PS:Giving a button "GO to the selected" would be more friendly to users.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 10-27-2007, 12:38 PM   PM User | #3
rams1703
New Coder

 
Join Date: Sep 2007
Posts: 34
Thanks: 0
Thanked 7 Times in 7 Posts
rams1703 is an unknown quantity at this point
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function openSite(thisELE)
{
var index = thisELE.selectedIndex;

if(index > 0)
{
window.location = thisELE.options[index].value;
}
}
</script>
</head>

<body>
<select name="Networksites" onchange="openSite(this)">
<option selected="selected">- Select -</option>
<option value="http://www.testsite.com">Testsite1.com</option>
<option value="http://www.testsite.com">Testsite.com</option>
<option value="http://www.testsite2.com">Testsite 2.com</option>
</select>
</body>
</html>

gud luck
rams,
rams1703 is offline   Reply With Quote
Users who have thanked rams1703 for this post:
CaptainB (10-27-2007)
Old 10-27-2007, 01:17 PM   PM User | #4
CaptainB
Regular Coder

 
Join Date: Jun 2007
Posts: 805
Thanks: 123
Thanked 23 Times in 23 Posts
CaptainB is an unknown quantity at this point
Thanks, that worked!
CaptainB is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:09 PM.


Advertisement
Log in to turn off these ads.