jsp 的求值问题?

来源:百度知道 编辑:UC知道 时间:2024/05/16 05:11:58
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>
<title>购物页面</title>
</head>
<body>
<h2 align="center">在线购物</h2
<form action="b.jsp">
<center>
<table border="1">
<tr bgcolor="lightblue">
<th>名称</th>
<th>单价</th>
<th>数量</th>
<th>总价</th>
</tr>

<tr >
<td width=100>DELL</td>
<td width=100 name="D">5000</td>
<td width=100><input type="text" size=10 name="DELL" ></td>
<td>//在单元格中输出总价
<%
String total;
double num=0;
request.getSession(true);
application.setAttribute("DELL","5000");
total=request.getParameter("DELL");
num=Double.parseDouble(total);

我帮你改了一下。
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>
<title>¹ºÎïÒ³Ãæ</title>
<script language="javascript">
function compute(){
var sum = DELL.value * 5000;
var output = document.getElementById("output");
output.innerHTML = sum;
}
</script>
</head>
<body>
<h2 align="center">ÔÚÏß¹ºÎï</h2
<form action="b.jsp">
<center>
<table border="1">
<tr bgcolor="lightblue">
<th>Ãû³Æ</th>
<th>µ¥¼Û</th>
<th>ÊýÁ¿</th>
<th>×ܼÛ</th>
</tr>

<tr >
<td wid