0
我正在寻找我的脚本接受下拉框中的百分比,在初始选择之后我想计算剩余百分比并将用户与另一个下拉框一起呈现,这将持续到那里在0值留在最后一个方框继续下拉框直到
这里是我的代码,到目前为止,第一个框的作品,但我已经创建之后我失去了扳机再次触发代码,
我要对这个正确的方法?任何人都可以建议如何改正数学,如果第一个下拉框的值改变了,林没有找人为我写代码和脚本只是一些声音指向哪里去与此。
这里是代码
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("#choice").change(function() {
valper = $(this).val() ;
valueLeft = 100 - valper;
newline = "<tr bgcolor='#666666'><td> </td> "
newline += "<td><select id='choice'> " ;
for(i=valueLeft; i >0; i--) {
newline += "<option value=" + i + ">" + i + " % </option> " ;
}
newline += "</select></td> <td> </td> </tr> " ;
$('#selector').append(newline)
});
});
</script>
<table width="500" border="1" cellspacing="1" cellpadding="1" bgcolor="#CCCCCC" align="center">
<tr>
<td width="50">top</td>
<td> </td>
<td width="50"> </td>
</tr>
<tbody id='selector' >
<tr bgcolor="#666666" >
<td> </td>
<td>
<select id="choice" name='1' >
<?php
for ($counter = 100 ; $counter > 0; $counter -= 1) {
echo "<option value='$counter'>$counter%</option> " ;
};
?>
</select></td>
<td> </td>
</tr>
</tbody>
<tr>
<td>Bottom</td>
<td> </td>
<td> </td>
</tr>
</table>