Page 1 of 1

[Solved] Javascript: item value to a textfield

Posted: Tue Apr 05, 2005 4:06 pm
by Shendemiar
I've seen code here somewhere that adds the value of an option to a textfield, but i couldn't find it. So:

I'd like a textbox named "Name" to have a value, when an option on a same form is clicked.

Something like this, but since i'm a javascript dummie, someone need to think it for me:

Code: Select all

<?php
echo "<INPUT TYPE=\"RADIO\" name=\"Renamee\" value=\"$key.$k2.$v2\" 
      onchange=\"document.forms['Form1'].elements['Name'].value = '$v2';\">
      $tmp: $v2<BR>\n";
?>

Posted: Tue Apr 05, 2005 4:10 pm
by Shendemiar
It was an easy one. I just changed the onchange to onclick! Damn i'm smart!