Jump to content

Javascript: Navigate from a Drop down menu

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Introduction:-
Here I will show you how to go to different websites from a drop down menu

Let's Begin:-
Make this code between the HEAD tags:-

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function GotoURL(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</SCRIPT>

and make this between the BODY tags:-

<form name="form">
<select name="site" size=1>
<option value="">Select where you want to go
<option value="http://www.time4videos.net.tc">Time4Videos
<option value="http://www.codecall.net">CodeCall
</select>
<input type=button value="Go there" onClick="javascript:GotoURL(this)">
</form>

Explanation:-
.......
<option value="">Select where you want to go
<option value="http://www.time4videos.net.tc">Time4Videos
<option value="http://www.codecall.net">CodeCall
.......

Include all the URL's here!

Conclusion:-
Code is attached, and feedback is welcome!

Attached Files



#2
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
You forgot something lol
</option>
Fix this ASAP. I don't know but I use </option>. If it's not needed, then ok.

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

xtraze said:

You forgot something lol
</option>
Fix this ASAP. I don't know but I use </option>. If it's not needed, then ok.


There is no need of that! Remember less code = less time your page will take to load ;)

#4
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
I was using </option> always dude, you may find a toolbar at the top of XTRaze.NET - Preloading images.... which is Edited by me for myself. And I was using </option> there too. I just saw this on another site and made a lot of changes and still going on to make this good for me.