...

View Full Version : JavaScript help please



lansing
06-01-2006, 01:18 AM
I am not sure what this is called in Javascript is called so I just tell you my problem.

I have a radio button that when I click on it it fills a 1 text box with data. This I have working just fine. I need the same click to fill a second text box with data. I will post my code below...currently it does fill the 1st text box without errors, but I need this to fill 2 text boxes & not just one.


onClick="document.form_name.text_box1.value='<?=$name1 ?>';"

Thanks!

Philip M
06-01-2006, 07:22 AM
onClick="document.form_name.text_box1.value='<?=$name1 ?>';document.form_name.text_box2.value='<?=$name1 ?>';"

Kor
06-01-2006, 08:58 AM
or if you need text_box3, tex_box4....

onclick="var i=1;while(document.form_name['text_box'+i]){document.form_name['text_box'+i].value='<?=$name1 ?>';i++}"

lansing
06-01-2006, 01:52 PM
onClick="document.form_name.text_box1.value='<?=$name1 ?>';document.form_name.text_box2.value='<?=$name1 ?>';"I have this & it wont work. It wont populate anything in any text box. Will this coding work in all browsers?
onClick="document.form_name.text_box1.value='<?=$name1 ?>'; document.form_name.text_box2.value='<?=$name2 ?>';"



or if you need text_box3, tex_box4....

onclick="var i=1;while(document.form_name['text_box'+i]){document.form_name['text_box'+i].value='<?=$name1 ?>';i++}"Each text_box will have a different variable assigned to it. Like text_box1 will need $text_box1 & text_box2 will need $text_box2 variable.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum