我有四個的Fileds表如圖如何刪除並創建它的父元素一個輸入框,如果選擇標籤改變其值
Semester | Exam Status | GPA | Fee Status
我的問題是:當我改變的價值在Exam_Status
的Select tag->
沒有清除,然後G.P.A
字段可以刪除就可以了,當我選擇Cleared
它可以顯示我G.P.A
字段。
HTML代碼生成folloing piture輸出以下
<table cellspacing="0" cellpadding="0" border="0">
<thead>
<tr>
<th>Semester</th>
<th>Cleared/Not Cleaerd</th>
<th>G.P.A</th>
<th>Fee Status</th>
</tr>
</thead>
<tbody>
<script type="text/javascript"></script>
<tr>
<td>1<sup>st</sup> Semester</td>
<td>
<select name="fexam_status" id="waqas">
<option selected="selected">Select Here</option>
<option value="Cleared">Cleared</option>
<option value="Not Cleared">Not Cleared</option>
</select>
</td>
<td>
<div class="gpa" id="work">
<div class="right">
<input class="spin-dec" type="text" name="fgpa" value="3.00" min="1.00" max="4.00" />
</div>
</div>
</td>
<td>
<select name="ffee_status">
<option value="Cleared">Cleared</option>
<option value="Not Cleared">Not Cleared</option>
</select>
<a class="deleteRow" style="margin-left: 10px;"><img src="gfx/deletered.png" /></a>
</td>
</tr>
<tr>
<td>2<sup>nd</sup> Semester</td>
<td>
<select name="sexam_status">
<option selected="selected" value="Cleared">Cleared</option>
<option value="Not Cleared">Not Cleared</option>
</select>
</td>
<td>
<div class="gpa">
<div class="right">
<input class="spin-dec" type="text" name="sgpa" value="3.00" min="1.00" max="4.00" />
</div>
</div>
</td>
<td>
<select name="sfee_status">
<option selected="selected" value="Cleared">Cleared</option>
<option value="Not Cleared">Not Cleared</option>
</select>
<a class="deleteRow" style="margin-left: 10px;"><img src="gfx/deletered.png" /></a>
</td>
</tr>
<tr>
<td>3<sup>rd</sup> Semester</td>
<td>
<select name="texam_status">
<option selected="selected" value="Cleared">Cleared</option>
<option value="Not Cleared">Not Cleared</option>
</select>
</td>
<td>
<div class="gpa">
<div class="right">
<input class="spin-dec" type="text" name="tgpa" value="3.00" min="1.00" max="4.00" />
</div>
</div>
</td>
</tr>
</tbody>
</table>
並且類似地當我選擇Fee_Status - >不會被清除它可以告訴我一個輸入標籤insteat在FEE SELECT TAG的STATUS
使用選擇框的'onchange'事件,例如:''你可以看到我將當前選擇標記對象引用傳遞給函數'showHideGPA()',這樣函數將能夠確定哪個選擇框被改變並遍歷dom來改變適當的表格單元格。當然,您也可以使用選擇框引用來檢查其值,並相應地採取行動。 – Yaniro 2012-03-04 12:45:15