VBScript放在ASP里面就不能执行,以下代码怎么改成JavaScript的语句呢?

<ScriptLanguage="VBScript">SubGetTotalIfisNumeric(Forma.price.Value)=TrueAndisNumeric... <Script Language="VBScript">
Sub GetTotal
If isNumeric(Forma.price.Value) = True And isNumeric(Forma.number.Value) = True Then
Forma.total.Value = Forma.price.Value * Forma.number.Value
Else
Forma.total.Value = 0
End If
End sub
</Script>

<form name="Forma" onSubmit="return checkform();" action=save.asp method=post style="width:521px;margin:0;">
<table width="675" border="0">
<tr>
<td>单价</td>
<td><input type="text" name="price" size="20" onChange = "GetTotal"></td>
<td>数量</td>
<td><input type="text" name="number" size="20" onChange = "GetTotal"></td>
<td>总计</td>
<td><input type="text" name="total" size="20"></td>
<td> </td>
</tr>

</table></form>
现在用label元素,可以在ASP里面显示总计价格了,但是不能把total这个值存如数据库里呀!<TD width="27%"><label name="total" id="total"></label>元</TD>
展开
 我来答
cninca
2012-12-14 · TA获得超过366个赞
知道小有建树答主
回答量:337
采纳率:0%
帮助的人:167万
展开全部
html标签中的name并不是直接对应脚本中的变量;每个html标签在脚本中映射为一个对象,通过指定的函数提取,只要你知道这个函数,将你的代码修改一下,就可以了。
老刀正能量
推荐于2016-07-14 · TA获得超过2011个赞
知道大有可为答主
回答量:1487
采纳率:0%
帮助的人:1515万
展开全部
<script language="javascript">
function GetTotal(){
var theForm=document.forms["Forma"];
if (!isNaN(theForm["price"].value)&&!isNaN(theForm["number"].value)){
theForm["total"].value = Number(theForm["price"].value) * Number(theForm["number"].value);
}else{
theForm["total"].value = 0
}
}

</script>

调用改成以下:
<form name="Forma" id="Forma" onSubmit="return checkform();" action=save.asp method=post style="width:521px;margin:0;">
<td>单价</td>
<td><input type="text" name="price" id="price" size="20" onchange="GetTotal()"></td>
<td>数量</td>
<td><input type="text" name="number" id="number" size="20" onchange="GetTotal()"></td>
<td>总计</td>
<td><input type="text" name="total" id="total" size="20"></td>
</form>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式