|
|
|
คำสั่ง Select จะทำคำสั่ง Select เพื่อเลือกรายการ โดยให้รายการแต่ละรายการต่างฟังก์ชั่นกัน |
|
|
|
|
|
|
|
Code (PHP)
<script>
function fncSelect(){
var sel =document.getElementById('sel')
var idx =sel.options[sel.selectedIndex].value;
if(idx=='a'){
document.getElementById('show').innerHTML="data A";
}else if(idx=='b'){
document.getElementById('show').innerHTML="data B";
}
}
</script>
<div id="show"></div>
<select id="sel">
<option value="a">a</option>
<option value="b">b</option>
</select>
<input type="button" onclick="fncSelect()" value="click">
|
|
|
|
|
Date :
2009-11-18 01:26:39 |
By :
xbeginner01 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a b คือ ค่า value ที่มาจาก select ครับ
data A ,data B เป็นค่าทีแสดงที่ id show ครับ ซึ่งจะแสดงอะไรก็ขึ้นอยู่กับเงื่อนไข if-else
จะให้ไปที่ฟังก์ชัน
Code (PHP)
if(idx=='a'){
start1();
}else if(idx=='b'){
start2();
}
|
|
|
|
|
Date :
2009-11-20 00:40:34 |
By :
xbeginner01 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|