This is an old revision of the document!


Javascript Code Snippets

This example shows a menu that changes languages. It actually goes to a different side with the selected language. The selection is what triggers the page change, therefore specify the selected option so that the user will change it to something else, thus triggering the page change.

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
 
<body>
Some text here...
 
Menu to Switch Languages:
<form name="formLangSelection" id="search">
    Language 
    <select name="menuLangSelection" id="menuLangSelection" onChange="MM_jumpMenu('parent',this,0)">
        <option value="http://www.example.com/en" selected>English</option>
        <option value="http://www.example.com/es">Espa&ntilde;ol</option>
    </select>
</form>
 
</body>
</html>