如何使用javascript函数在文本框中显示结果 [英] How to Show Result in Textbox using javascript function

查看:742
本文介绍了如何使用javascript函数在文本框中显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在txtValue上显示服务器文本框txtQty和txtPrice的muptiple结果

点击txtQty或txtPrice

我创建了以下javascript函数



函数CalculateValue(){



var strQty = $([id $ ='txtQty'])。 val();

var strPrice = $([id $ ='txtPrice'])。val();

var strValue =(parseFloat(strQty)* parseFloat(strPrice));



$([id $ ='txtValue'])。text = strValue;

返回false ;

当我单击文本框txtPrice

I have to show muptiple result of server textbox txtQty and txtPrice on txtValue
when click on txtQty or txtPrice
I have created the following javascript function

function CalculateValue() {

var strQty = $("[id$='txtQty']").val();
var strPrice = $("[id$='txtPrice']").val();
var strValue = (parseFloat(strQty) * parseFloat(strPrice));

$("[id$='txtValue']").text = strValue;
return false;
My requirement is to show the result in textbox txtValue when I click textbox txtPrice

推荐答案

([id

<]时,我的要求是在textbox txtValue中显示结果br />


='txtQty'])。val();

var strPrice =
='txtQty']").val();
var strPrice =


([id


这篇关于如何使用javascript函数在文本框中显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆