FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

how to open?

 


b3nsoi
Sir i have a new project I want to open a new page by using combo box or drop down menu ... thanks and God Bless
ncwdavid
Here is the code for a dropdown menu using javascript:

Quote:
<script language="JavaScript">
<!--
function MenuRedirect(menu){
var itemselected=menu.options[menu.options.selectedIndex].value;
if(itemselected=="") return;
var menuitem=itemselected.split(";");
if(menuitem[1]=="0") self.location=menuitem[0];
if(menuitem[1]=="1") top.location=menuitem[0];
if(menuitem[1]=="2") window.open(menuitem[0]);
}
//-->
</script>
<select name="mywebmenu" size="1" style="font-family:Abadi MT Condensed; color:#000000; background-Color:#FFFFFF;" onChange="MenuRedirect(this);">
<option value="http://yourdomain.com;0">yourpage</option>
</select>


The only txt you have to change in the code is the txt in bold which you change to your own values.

You only have two must change options in the dropdown menu called yourpage which you change to your own value and yourdomain.com which you chang to the site you want to be redirected to.

If you want to add more options to the dropdown menu enter in this code after the </option> which is near the end of the code:

Quote:
<option value="http://yourdomain.com;0">yourpage</option>


and just change the txt in bold to your own values.

Feel free to edit the code to suit your needs.
mariohs
I have posted in another topic a way to create a dropdown menu with only (x)html and css, and a javascript fix just for IE, it's fast, lightweight and works like a charm Very Happy
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.