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> 展开
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> 展开
展开全部
<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>
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>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询