通過寫JAVASCRIPT腳本實現﹐ 寫數量文本框的onblur(焦點離開)事件
document.all.金額.value or innerText = 單價*數量

解决方案 »

  1.   

    楼上主的确实好,但我对jsp不熟,不知道如何实现
      

  2.   

    再你的JSP頁面上寫入下面代碼﹕
    //如果AMT為文本框則用value﹐是層就用innerText,PRICE同理﹐
    //另外需要注意的是控件的name值﹐不然得不到結果的噢﹐自己看看JS吧
    <script for="QTY" event="onblur">
      document.all.AMT.value = document.all.PRICE.value * this.value;
    </script>
      

  3.   

    你的AMT、document、all分别是什么意思?
    this又是何意?
    问这样的问题你会生气的话,那就精神在打我吧
      

  4.   

    javascript你一點都不會阿﹖﹖  我暈.......
    //AMT 金額欄位, PRICE 價格欄位, QTY數量欄位.
    如果是不會腳本的話 我也幫不了你了........
      

  5.   

    <td><div align="center"><input name="lcsl" type="text" id="lcsl" onBlur="onblur"></div></td><head>
    <script for="lcsl" event="onblur"> hjje.value = lcsl.value * <%=rs.getString("price")%>;
    </head>
    有错。
    谁能告诉我
      

  6.   

    <td><div align="center"><input name="lcsl" type="text" id="lcsl" onBlur="onblur1(this.value,<%=rs.getString("price")%>)" value=""></div> </td>
      function onblur1(int,int){
      document.all.hjje.value = int*price1;
      }调用处有错。怎么改?
      

  7.   

    <td><div align="center"><input name="lcsl" type="text" id="lcsl" onBlur="onblur1(this.value,<%=rs.getString("price")%>)" value=""></div> </td>
    ------------------------------------------
    <script language="javascript">
    -----------------------------------------  function onblur1(int,int){
      document.all.hjje.value = int*price1;
      }------------------------------------------
    </script>
    -----------------------------------------两条线所夹的语句是必须的.
      

  8.   

    还有你的int*price1;
    是什么意思?
    强制转换pricel为整形和指针?
    还是int乘pricel?
    int不可以直接乘....
      

  9.   

    我已经解决了。谢谢各位.一周后结贴
    帮看看这个
    http://community.csdn.net/Expert/topic/4296/4296593.xml?temp=.9283258