我的onChange为什么出错

mycslife 2005-03-21 02:46:41
我要实现的是输入文本框数字,结果后改变,但是去总是报错不能运行,请问错在哪里:
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT language="JavaScript">
fuction Total()
{
var tot=0;
tot+=(40.00*document.order.qty1.value);
tot+=(69.95*document.order.qty2.value);
tot+=(99.95*document.order.qty3.value);
tot+=(4.95*document.order.qty4.value);
document.order.totalcost.value=tot;
}

fuction UpdateCost(number,unitcost)
{
costname="cost"+number;
qtyname="qty"+number;
var q=document.order[qtyname].value;
document.order[costname].value=q*unitcost;

}
</SCRIPT>
</HEAD>

<BODY >
<h1>Order Form</h1>
<form name="order">
<b>Name:</b><input type="text" name="name1" size=20>
<b>Phone:</b><input type="text" name="phone" size=15>
<b>E-mail address</b><input type="text" name="email" size=20><br>
<b>Billing and Shipping Addresses:</b><br>
<textarea name="billto" cols=40 rows=4>
Enter your billing address here.
</textarea>
<textarea name="shipto" cols=40 rows=4>
Enter your shipping address here.
</textarea>
<br>
<b>Products to Order:</b><br>
Qty:<input type="TEXT" name="qty1" value="0" size=4 onChange="UpdateCost(1,40.00);">
Cost:<input type="text" name="cost1" size=6>
($40.00ea)Fictional Spreadsheet 7.0<br>

Qty:<input type="TEXT" name="qty2" value="0" size=4 onChange="UpdateCost(2,69.95);">
Cost:<input type="text" name="cost2" size=6>
($69.95ea)Fictional Word Processor 6.0<br>

Qty:<input type="TEXT" name="qty3" value="0" size=4 onChange="UpdateCost(3,99.95);">
Cost:<input type="text" name="cost3" size=6>
($99.95ea)Fictional Database 7.0<br>

Qty:<input type="TEXT" name="qty4" value="0" size=4 onChange="UpdateCost(4,4.95);">
Cost:<input type="text" name="cost4" size=6>
($4.95ea)Instruction Booklet for the above<br>

<b>Total Cost:</b>
<input type="text" name="totalcost" size=8><hr>

<b>Method of Payment</b>:
<select name="payby">
<option value="check" selected>Check or Money Order</option>
<option value="cash">Cash or Cashier's Check</option>
<option value="credit">Credit Card</option>
</select>
<br>
<b>Credit Card or Check Number:</b>
<input type="text" name="creditno" size="20"><br>
<input type="submit" name="submit" value="send your order">
<input type="reset" value="start over">
</form>

</BODY>
</HTML>
...全文
189 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
心云意水 2005-03-21
  • 打赏
  • 举报
回复
<SCRIPT language="JavaScript">
fuction Total()
{
var tot=0;
tot+=(40.00*document.order.qty1.value);
tot+=(69.95*document.order.qty2.value);
tot+=(99.95*document.order.qty3.value);
tot+=(4.95*document.order.qty4.value);
document.order.totalcost.value=tot;
}

fuction UpdateCost(number,unitcost)
{
costname="cost"+number;
qtyname="qty"+number;
var q=document.order[qtyname].value;
document.order[costname].value=q*unitcost;

}
</SCRIPT>


我晕死!
function,不是fuction的说!
拜托稍微仔细一点!-_-
梅雪香 2005-03-21
  • 打赏
  • 举报
回复
文本框没有onChange事件
改用onpropertychange

684

社区成员

发帖
与我相关
我的任务
社区描述
智能路由器通常具有独立的操作系统,包括OpenWRT、eCos、VxWorks等,可以由用户自行安装各种应用,实现网络和设备的智能化管理。
linuxpython 技术论坛(原bbs)
社区管理员
  • 智能路由器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧