|
將- eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
複製代碼 改為- var s = selObj.options[selObj.selectedIndex].value;
- window.open(s);
複製代碼 完整範例如下:- <SCRIPT language="JavaScript">
- <!--
- function MM_jumpMenu(targ,selObj,restore){ //v3.0
- var s = selObj.options[selObj.selectedIndex].value;
- window.open(s);
- if (restore) selObj.selectedIndex=0;
- }
- //-->
- </SCRIPT>
- Then function called from form:
- <FORM name="form1">
- <SELECT name="menu1" onChange="MM_jumpMenu('parent',this,0)">
- <OPTION selected>-- select --</OPTION>
- <OPTION value="http://google.com">Google</OPTION>
- </SELECT>
- </FORM>
複製代碼 Reference: http://www.webdeveloper.com/forum/showthread.php?t=2709 |
|