js 드롭다운 상자 선택 점프

1387 단어 드롭다운 상자
선택 후 점프
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ, selObj, restore) { //v3.0
    alert(selObj.selectedIndex);
    eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
    if (restore) { //selected=true
        selObj.selectedIndex = restore;
    } else {
        selObj.selectedIndex = 0;
    }
}
//-->
</script>

<form name="form1" id="form1">
  <select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
    <option value="http://www.baidu.com">baidu</option>
    <option value="http://www.sohu.com">sohu</option>
  </select>
</form>

<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  window.open(selObj.value);
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
    <option value="http://www.21cn.com">21cn</option>
    <option value="http://www.163.com">163</option>
</select>

좋은 웹페이지 즐겨찾기