[PREV]
[1]
[NEXT]
|
|
|
동적으로 SELECT BOX안에 옵션 추가/삭제하기.
References/JavaScript |
2009/08/31 18:12
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>OPTION 동적 추가</title> <meta http-equiv="content-type" content="text/html; charset=euc-kr">
<script type="text/javascript" src="/js/mootools.js"></script> <script type="text/javascript"> function doChangeSelect(intBtnValue) {
var sltBox = $('select1');
var cnt = sltBox.length; for ( i=0; i<cnt; i++ ) { sltBox.options[i] = null; }
if ( 1 == intBtnValue ) { sltBox.options[0] = new Option('선택하세요', '0'); sltBox.options[1] = new Option('사과', '1'); sltBox.options[2] = new Option('딸기', '2'); sltBox.options[3] = new Option('수박', '3'); sltBox.options[4] = new Option('호박', '4'); sltBox.options[5] = new Option('오이', '5'); } else { sltBox.options[0] = new Option('선택하세요', '0'); sltBox.options[1] = new Option('고기', '1'); sltBox.options[2] = new Option('생선', '2'); } } </script>
</head> <body leftmargin=0 topmargin=0 marginwidth=0 marginheight="0" bgcolor="FFFFFF">
<div id="btn"> <input type="radio" name="btn" id="btn1" value="1" onclick="doChangeSelect(this.value)" /> <label for="btn1">셀렉트1</label> <input type="radio" name="btn" id="btn2" value="2" onclick="doChangeSelect(this.value)" /> <label for="btn2">셀렉트2</label> </div>
<div id="slt"> <select name="select1" id="select1"> <option value="0">선택하세요</option> </select> </div>
</body> </html> |
WOWpc
2009/08/31 18:12
2009/08/31 18:12
|
|
| 이 글의 관련글(트랙백) 주소 :: http://blog.wowpc.net/trackback/319 |
Tracked from Shaker style furniture. 2010/07/30 04:39 x
제목 : Shaker furniture.
Shaker furniture plasma tv stand. Shaker style furniture small hall table. Shaker furniture. Unfinished shaker furniture. Shaker furniture history. |
|
|
|
|
|
 |
Coming Soon(순이가 옵니다) (38) |
|
|
|
«
2009/08
»
| 일 |
월 |
화 |
수 |
목 |
금 |
토 |
| |
|
|
|
|
|
1 |
| 2 |
3 |
4 |
5 |
6 |
7 |
8 |
| 9 |
10 |
11 |
12 |
13 |
14 |
15 |
| 16 |
17 |
18 |
19 |
20 |
21 |
22 |
| 23 |
24 |
25 |
26 |
27 |
28 |
29 |
| 30 |
31 |
|
|
|
|
|
|
|
Total : 432348
Today : 38
Yesterday : 165
|
|
|