字符串拼接

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6     <link rel="stylesheet" type="text/css" href="css/e3.css"/>
 7     <script type="text/javascript" src="js/system.js"></script>
 8 </head>
 9 <body>
10 <select id="s1">
11     <option value="選擇">請選擇</option>
12     <option value="0">1</option>
13     <option value="1">2</option>
14     <option value="2">3</option>
15     <option value="3">4</option>
16     <option value="4">5</option>
17     <option value="5">6</option>
18 </select>
19 <select id="s2">
20     <option>請選擇</option>
21     <option></option>
22     <option></option>
23     <option></option>
24     <option></option>
25     <option></option>
26     <option></option>
27 </select>
28 <script type="text/javascript" src="js/e3.js"></script>
29 </body>
30 </html>
31 
32 
33 
34 
35 /** 36  * Created by Administrator on 2015/8/26. 37  */ 38 var s1 = $$("s1"); 39 var s2 = $$("s2"); 40 var arr2 = new Array("你是少年", "你是青年", "你是中年", "你是中老年", "你是老年", "能夠退休了"); 41 s1.onchange = function () { 42  var $v = this.value; 43     for (i = 0; i < arr2.length; i++) { 44  if (i == $v) { 45  var HTML = "<option value=" + i + ">" + arr2[i] + "</option>" 46  s2.innerHTML = HTML; 47  break; 48  } 49  } 50 }
相關文章
相關標籤/搜索