DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> JS文本框追加多個下拉框的值的簡單實例
JS文本框追加多個下拉框的值的簡單實例
編輯:關於JavaScript     
復制代碼 代碼如下:
<HTML>  
 <HEAD>  
  <TITLE> New Document </TITLE>  
  <META NAME="Generator" CONTENT="EditPlus">  
  <META NAME="Author" CONTENT="">  
  <META NAME="Keywords" CONTENT="">  
  <META NAME="Description" CONTENT="">  
<script language="javascript">
function doit(ofrm){
   //ofrm.t1.value=parseInt(ofrm.s1.value)+parseInt(ofrm.s2.value)+parseInt(ofrm.s3.value)+parseInt(ofrm.s4.value);
 ofrmofrm.t1.value=ofrm.s1.value+ofrm.s2.value+ofrm.s3.value+ofrm.s4.value;
}
</script> 
 </HEAD>  
 <BODY>  
<form name="tfrm">
<select name="s1" onChange="javascript:doit(this.form);">
<option value="*" selected>請選擇</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select name="s2" onChange="javascript:doit(this.form);">
<option value="*" selected>請選擇</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select name="s3" onChange="javascript:doit(this.form);">
<option value="*" selected>請選擇</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select name="s4" onChange="javascript:doit(this.form);">
<option value="*" selected>請選擇</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="text" name="t1" value="">
</form>
 </BODY>  
</HTML>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved