選択するとジャンプするセレクトボックス

<head>に記述

<script type='text/javascript'>
<!--
var target = '';
function jump(){
var url = document.form1.select.options[document.form1.select.selectedIndex].value;
if(url != '' ){
if(target == 'top'){
top.location.href = url;
}
else if(target == 'blank'){
window.open(url, 'window_name');
}
else if(target != ''){
eval('parent.' + target + '.location.href = url');
}
else{
location.href = url;
}
}
}
// -->
</script>

<body>に記述

<form action="#" name="form1">
<select name="select" onChange="jump()">
<option value='hogehoge1.php?id=1'>hogehoge1</option>
<option value='hogehoge1.php?id=2'>hogehoge2</option>
<option value='hogehoge1.php?id=3'>hogehoge3</option>
</select>
</form>

コメント

タイトルとURLをコピーしました