Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript set value

Status
Not open for further replies.

jagi

Programmer
Mar 13, 2005
48
US
Hi,
I have a hidden field and a check box, I want to change the value of the checkbox onclick event, but for some reason the value is not getting set. could somebody tell me if I am doing anything wrong..??

thanks
jag
below is the code..

<input type="hidden" name="unitRefunded" value="false"/>

<input type="checkbox" name="inputUnitIncluded1" onclick="javascript:toggle2(unitRefunded,unitRefunded.value)" checked/>

my javascript method which is in the head
function toggle(temp1, temp2)
{
alert('temp1 -- ' + temp1.value + ' temp2(t/f) ' + temp2);
if(temp2 == false)
{
temp1.value = true; //this is not happening!!
}
else
{
temp1.value = false;
}

}
 
temp2 is a string, not a boolean.

Change this:

<input type="checkbox" name="inputUnitIncluded1" onclick="javascript:toggle2(unitRefunded,unitRefunded.value)" checked/>

to this:

<input type="checkbox" name="inputUnitIncluded1" onclick="javascript:toggle2(unitRefunded,unitRefunded.checked)" checked/>

Adam

Whatever I feel like I wanna do, gosh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top