开发者

Dynamically changed value of text box should have to be changed on radio button click?

I have 3 textboxes and respective radio buttons associated with it.The value of the first text boxe are retrieved from database and all calculation are being done on the database value.But 开发者_StackOverflow中文版if i want to change the first text box value manually the next 2 boxes values must have to changed.And i dnt want to insert this manually entered value into database.can u tell me how to perform calculation on the manually inserted value into textbox.

Thanks in advance


you can use javascript and onchange event on textbox.

add event to textbox properties:

onChange="calculate();"

write a javascript function:

function calculate(){
    var calculatedValue = textbox1.value;
    //calculate
   textbox2.value = calculatedValue; 
}

I didn't check it, but it should work.


$('#textbox1').change(function(){

     var value = $(this).val();

     var value2 = function1(value);
     var value3 = function2(value);

    $('#textbox2').val(value2);
    $('#textbox3').val(value3);

});

function function1(){
    //do calculation 
}

function function2(){
    //do calculation 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜