看板 Web_Design 關於我們 聯絡資訊
想請教如何在一個頁面當中出現多個下拉式選單? 我目前是這樣寫:(沒有用到資料庫,只有連到該網頁) <form id="form1" name="form1" method="post" action=""> <script language="JavaScript"> <!-- function surfto(form) {var myindex=form.select1.selectedIndex; window.open(form.select1.options[myindex].value,'_self','');} //--> function showInfo(obj) {alert(obj[obj.selectedIndex].getAttribute("text"));} </script> <select name="select1" id="form" onchange="document.getElementById('ft1'). innerHTML=''+this[this.selectedIndex].title;"> <option value="000.html" title="000" selected="selected">000</option> <option value="111.html" title="111">111</option> <option value="222.html" title="222">222</option> </select> <input type="button" value="GO" onClick="surfto(this.form)"/></form> <span id="ft1"></span> 可是只要複製第二個,就會打架,其中一個無法使用, 就算改變select1為select2也沒有辦法, 想請問還有哪邊需要改? 還有一個問題是,我要讓他選擇後(還沒按GO)先顯示title的值, 這部份是已經ok的,但一進入網頁時,他並不會先出現預設(000)的title, 必須先選到111、222...才會出現, 不知道該怎麼修改,讓他直接先出現selected的title? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.165.163.104