Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Manipulate the value of an input box based on whether a checkbox

chineeratchineerat Member Posts: 4
Hi!

I am trying to manipulate the value of an input box based on whether a checkbox is checked or not.
example
checked input = 1600 and enabled
unchecked input = 0 and disabled

I am having 2 problems:
1) When the page is loaded I get unchecked and input = 1600: it should be : either
checked input = 1600 and enabled
or
unchecked input = 0 and disabled

2) When the checkbox is checked for the 2nd time the input remains 0 it should go back to the initial value 1600

can anyone help me?
[CODE]


[/CODE]

[CODE]
[/CODE]

Comments

  • shahanemaheshshahanemahesh Member Posts: 2
    Hi,
    You need some modification in code as,

    [color=Blue]

    Untitled Page


    function enable_text()
    {
    if (document.f1.R1.checked == true)
    {
    var var_gate_request_original = 1600 ;

    document.f1.GateRequest0.disabled =false;
    document.f1.GateRequest0.value = var_gate_request_original ;
    }
    else if (document.f1.R1.checked == false)
    {
    var var_gate_request_original = document.f1.GateRequest0.value ;
    var var_gate_request_zero = 0 ;

    document.f1.GateRequest0.value = var_gate_request_zero;
    document.f1.GateRequest0.disabled =true;
    }
    }










    [/color]
Sign In or Register to comment.