PDA

View Full Version : Trouble Changing Two Values


Candrias77
03-18-2003, 09:48 PM
Hi there, I am using the following script (on a radio button) to make two text input boxes empty when the radio button is checked:

onFocus="((document.pledgeForm.kmDonation.value='')&&(document.pledgeForm.lumpSumDonation.value=''))"

However this does not work. Both
onFocus="(document.pledgeForm.kmDonation.value='')"
and
onFocus="(document.pledgeForm.lumpSumDonation.value='')"
work but they do not work together.

I have tried a number of different syntax but it just doesn't want to work for me! I am sure that this can not be too hard to remedy, any help is appreciated.

Cheers

Adam20002
03-18-2003, 09:56 PM
i think



onFocus = "document.pledgeForm.kmDonation.value='';document.pledgeForm.lumpSumDonation.value=''";



should work.

cheesebagpipe
03-18-2003, 10:01 PM
You're using the Boolean and (&&) to combine multiple statements; the semicolon character is actually used to separate these.

onclick="if(this.checked)kmDonation.value=lumpSumDonation.value=''">

The above should do both in one go.

Candrias77
03-18-2003, 10:22 PM
Yeah thanks, I see what I did now, much appreciated.