0
我有這樣的代碼:更新下一個元素
<div class="trackOn" id="line1">
<span class="trackCounter">1</span>
<span class="trackTime1">
<select name="hours[]" class="trackInputDate" onChange="updateHours(this.value)" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>
<span class="trackTime2"></span>
<span class="trackTime3"></span>
</div>
<div class="trackOn" id="line2">
<span class="trackCounter">2</span>
<span class="trackTime1">
<select name="hours[]" class="trackInputDate" onChange="updateHours(this.value)" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>
<span class="trackTime2"></span>
<span class="trackTime3"></span>
</div>
<div class="trackOn" id="line3">
<span class="trackCounter">3</span>
<span class="trackTime1">
<select name="hours[]" class="trackInputDate" onChange="updateHours(this.value)" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>
<span class="trackTime2"></span>
<span class="trackTime3"></span>
</div>
<div class="trackOn" id="line4">
<span class="trackCounter">4</span>
<span class="trackTime1">
<select name="hours[]" class="trackInputDate" onChange="updateHours(this.value)" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>
<span class="trackTime2"></span>
<span class="trackTime3"></span>
</div>
現在,舉例來說,如果我從#line2
選擇值3
我想改變下選擇的價值boxex(在#line3
和#line4
上的那些)在3
。
是的updateHours()是fucntion,但我可以避免它,並使用此事件處理程序......好多了:)無論如何,我得到這個錯誤對象#<一個HTMLSelectElement>沒有方法'VAL'' – markzzz 2011-04-26 14:11:49
I目前有問題連接到jsfiddle.net,但我會盡快提供演示。 – 2011-04-26 14:12:22
@markzzz:這是一個錯字,我在'(this)'前面忘了'$'。固定。 – 2011-04-26 14:13:12