日期:2014-05-17  浏览次数:20854 次

新手请教数字加或减的时候实时显示并存入数据库?
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="all_cont">

  <tr>
  <th width="100"><strong>序号</strong></th>
  <th><strong>+ 利息 -</strong></th>
  <th>
  <strong>自定义调节幅度</strong>
  <select name="aa">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="5">5</option>
  <option value="10">10</option>
  <option value="20">20</option>
  <option selected="selected" value="0.5">默认</option>
  </th>
  </tr>
  
  <tr>
  <td align="center">1</td>
  <td align="center">99.50</td>
  </tr>
  
  <tr>
  <td align="center">2</td>
  <td align="center">88.50</td>
  </tr>
  
  <tr>
  <td align="center">3</td>
  <td align="center">77.50</td>
  </tr>
  
  <tr>
  <td align="center">4</td>
  <td align="center">66.50</td>
  </tr>
  
  <tr>
  <td align="center">5</td>
  <td align="center">55.50</td>
  </tr>
  
</table>


如上的这段代码,其中,点击“利息“旁边“+”号或”-“的时候,下面的所有数字都会相应的增加或减少默认的0.5,也可以按照旁边选择框调节幅度。同时,把所有增加或减少的数字用post方式发送到post.php文件中。
用JS怎么实现呢?
------解决方案--------------------
事件触发时,post到一个servelt中,servlet里面去写数据库
------解决方案--------------------
+和-两个按钮分别写一个onclick事件,点击按钮的时候拿到文本框的值,在加或减