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

jsp 页面标签计算 就解答 急
<tr>
  <td valign="top"><br></td><td height="28" align="center">价&nbsp;&nbsp;格:</td>
  <td class="word_grey"><input name="MONEY" type="text" id="" >
  <span class="style1">元/张</span></td>
  </tr>
  <tr>
  <td valign="top"><br></td><td height="28" align="center">总 &nbsp;&nbsp;数</td>
  <td height="28"><input name="AMOUNT" type="text" onBlue='autocount()' >
  </td>
  </tr>
  <script type="text/javascript">
  function autocount(){
  var AMOUN=document.getElementById('AMOUN').value;
  var MONEY=document.getElementById('MONEY').value;
   
  document.getElementById('TOTAL_MONEY').value=AMOUN*MONEY;
  }
  </script>
  <tr>
  <td valign="top"><br></td><td height="28" align="center">TOTAL_MONEY:</td>
  <td><input name="TOTAL_MONEY" type="text" id="" readonly="ture" ></td>
  </tr>






怎样 在输入 价格 和 数量之后 TOTAL_MONEY 自动计算出总价格 上述为部分代码 包含 javascript 函数

------解决方案--------------------
失去焦点事件是onblur 不是onBlue
------解决方案--------------------
楼主你太粗心了 给你改号了

Java code
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<jsp:directive.page import="dao.*"/>
<jsp:directive.page import="domain.*"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
    
  <title>My JSP 'ka_xiao_record_add.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  <style type="text/css">
<!--
.style1 {color: #FF0000}
.style3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 36px;
color: #0000FF;
}
-->
  </style>
    <script type="text/javascript">
  function autocount(){
  var AMOUN=document.getElementById('AMOUNT').value;
  var MONEY=document.getElementById('MONEY').value;
    
  document.getElementById('TOTAL_MONEY').value=AMOUN*MONEY;
  }
  </script>

    
  </head>
   
  <body>
  <h1 align="center" class="style3"> 卡销售 录入</h1>

  <td align="center">
<form action="ka_xiao" method="post" name="ka_xiao">
<table width="923&q