| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1143 人关注过本帖
标题:[求助]两数相乘(我知道怎么做了,大家可以看看,虽然很简单,但对我很重要 ...
只看楼主 加入收藏
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
结帖率:68.57%
收藏
 问题点数:0 回复次数:3 
[求助]两数相乘(我知道怎么做了,大家可以看看,虽然很简单,但对我很重要哦!)
各位老师:
我想实现以下的功能:

总价(ZONGJIA)=数量(SHULIANG)*单价(DANJIA)

说明:数量是输入的,单价是从数据库中获取的
输入数量后,自动计算出总价,请问各老师怎么实现?

<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >数量:</td>
<td width="66%" >
<input name=SHULIANG type=text id="SHULIANG" size=3 maxlength=3 onMouseOver="this.focus();" >
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >单价:</td>
<td width="66%" ><input name="DANJIA" type="hidden" id="DANJIA" value="<%=request("DANJIA")%>" >
<%=request("DANJIA")%>
<span class="style3">元</span> 
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >总价:</td>
<td width="66%" >
<input name=ZONGJIA type=text id="ZONGJIA" size=6 maxlength=6 >
<span class="style3">元</span> 
</td>
</tr>
(输入数量后,自动计算出总价,请问各老师怎么实现?谢谢!)



[此贴子已经被作者于2006-12-8 17:26:37编辑过]

搜索更多相关主题的帖子: 相乘 
2006-12-08 12:26
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
有老师在吗?

我知道这问题对老师们很简单!
但我也知道,我懂怎么做也很重要哦~~

我是农家的孩子,我有农家孩子的本色!
2006-12-08 15:33
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
得分:0 
FormatNumber(csng(request("DANJIA"))*request("shuoliang"),1)

我没有试过我不知道行不行,你试试

没有什么能够阻挡,我对自由的向往,天马行空的生涯一颗心了无牵挂。
2006-12-08 16:46
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
[求助]两数相乘(懂了,可以看看吧,虽然很简单,但对我很重要,呵呵~~)

非常感谢
FormatNumber(csng(request("DANJIA"))*request("shuoliang"),1)
我试了不行,但是我知道怎么做了。红色部分是要加的就可以了。

<form name="frm" >
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >数量:</td>
<td width="66%" >
<input name=SHULIANG type=text id="SHULIANG" size=3 maxlength=3 onMouseOver="this.focus();" onChange="ZONGJIAHS(document.frm.DANJIA.value,this.value,document.frm.ZONGJIA)">
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >单价:</td>
<td width="66%" ><input name="DANJIA" type="hidden" id="DANJIA" value="5" onChange="ZONGJIAHS(this.value,document.frm.SHULIANG.value,document.frm.ZONGJIA)">
<%=request("DANJIA")%>
<span class="style3">5元</span> 
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >总价:</td>
<td width="66%" >
<input name=ZONGJIA type=text id="ZONGJIA" size=6 maxlength=6 >
<span class="style3">元</span> 
</td>
</tr>
</form>
<script language="JavaScript" >
function ZONGJIAHS(SHULIANG,DANJIA,ZONGJIA)
{
ZONGJIA.value = DANJIA * SHULIANG;

}
</script>



<form name="frm" >
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >数量:</td>
<td width="66%" >
<input name=SHULIANG type=text id="SHULIANG" size=3 maxlength=3 onMouseOver="this.focus();" onChange="ZONGJIAHS(document.frm.DANJIA.value,this.value,document.frm.ZONGJIA)">个
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >单价:</td>
<td width="66%" ><input name="DANJIA" type="hidden" id="DANJIA" value="5" onChange="ZONGJIAHS(this.value,document.frm.SHULIANG.value,document.frm.ZONGJIA)">
<%=request("DANJIA")%>
<span class="style3">5元</span> 
</td>
</tr>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F6FcF9'">
<td width="32%" align="right" >总价:</td>
<td width="66%" >
<input name=ZONGJIA type=text id="ZONGJIA" size=6 maxlength=6 >
<span class="style3">元</span> 
</td>
</tr>
</form>
<script language="JavaScript" >
function ZONGJIAHS(SHULIANG,DANJIA,ZONGJIA)
{
ZONGJIA.value = DANJIA * SHULIANG;

}
</script>

[此贴子已经被作者于2006-12-8 17:18:39编辑过]


我是农家的孩子,我有农家孩子的本色!
2006-12-08 17:07
快速回复:[求助]两数相乘(我知道怎么做了,大家可以看看,虽然很简单,但对我很 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018117 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved