The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Javascript : Auto redirection select dropdown .... weird
I am trying to place this auto redirect select dropdown box on the postbits of all member.
The code: Code:
<Script language="JavaScript"> <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development function goto(form) { var index=form.select.selectedIndex if (form.select.options[index].value != "0") { location=form.select.options[index].value;}} //--> </SCRIPT> <FORM NAME="form1"> <SELECT NAME="select" ONCHANGE="goto(this.form)" SIZE="1"> <OPTION VALUE="$vboptions[bburl]/index.php">Home <OPTION VALUE="$vboptions[bburl]/usercp.php">Control Panel </SELECT> </FORM> Once there, all a user has to do is select the appropriate item in the dropdown, say "Control Panel" and it will automatically redirect to the usercp.php page. However it doesn't seem to redirect. Anyone, any ideas why this doesn't work ? Edit : hmm odd, it works on IE it seems but not on Firefox. Is there any way around it so that it works on all browsers ? Ok nvm...ended up using this code and it seems to work : Code:
<SELECT name="select" ONCHANGE="window.location=(this.options[selectedIndex].value);" SIZE="1"> |
#2
|
||||
|
||||
Alternately you could have a look at the code used for the dropdown menus in the admincp (for usergroups for example).
|
#3
|
|||
|
|||
The script I use....
Code:
<script language="JavaScript"> <!-- function goToURL(form) { var myindex=form.dropdownmenu.selectedIndex if(!myindex=="") { //window.location.href=form.dropdownmenu.options[myindex].value; //This is an alternative method you can use var Target = "_blank"; window.open(form.dropdownmenu.options[myindex].value,Target,""); } } //--> </script> and the form... Code:
<form name="dropDownForm"> <select name="dropdownmenu" size="1" onChange="goToURL(this.form)"> <option value="url">Text</option> <option value="url">Text</option> </select> </form> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|