PHP兩層下拉式選單資料傳回本頁的問題

edited 十月 2013 in Javascript
我的網頁有兩層式的下拉選單,第一層選擇之後,會跳出第二層的樣式;但我希望選擇之後,選擇的東西能出現在頁面上。
以下是我的程式碼:

<script>
department=new Array();
department[0]=["無"];
department[1]=["無","抒情","流行","民謠","情歌","輕快","其他"];
department[2]=["無","風景","花卉","卡通","節慶","時尚","其他"];
department[3]=["無","風景","花卉","卡通","節慶","時尚","其他"];

function renew(index){
for(var i=0;i<department[index].length;i++)
document.myForm.type.options=new Option(department[index], department[index]);// 設定新選項
document.myForm.type.length=department[index].length;// 刪除多餘的選項
}
</script>

<form name="myForm">
<p>種類:

<select name onChange="renew(this.selectedIndex);">
<option value="無">無
<option value="音樂">音樂
<option value="圖片">圖片
<option value="音樂卡">音樂卡
</select>

類型:
<select name="type">
<option value="">無
</select>

</p>
<p>
</form>

原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=5195

評論

Sign In or Register to comment.