藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年8月25日 8:28

請教點擊下拉菜單後自動完成文本框內容填寫

例如:
我想點擊左邊的列表,讓右邊的文本域自動填寫出所選列表項目的值!

這樣我可以事先定義好很多常用的內容,方便填寫表單用!
謝謝高手了!
[html]
<select name="select">
  <option selected>請選擇</option>
  <option value="red">紅色標記</option>
  <option value="blue">蘭色標記</option>
  <option value="black">黑色標記</option>
</select>
<textarea name="text1"></textarea>
[/html]

那得用javascript 實現吧?

不過這個我到不是很會,你可以在baidu.com 上搜索些相關的資料看看的。

下拉菜單onchange事件,用document寫入文本框

[html]<select name="select" onchange="text1.value+=this.options[this.options.selectedIndex].value">
  <option selected>請選擇</option>
  <option value="red">紅色標記</option>
  <option value="blue">蘭色標記</option>
  <option value="black">黑色標記</option>
</select>
<textarea name="text1"></textarea>
[/html]




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com