SharkBait Posted December 14, 2006 Share Posted December 14, 2006 Ok I have a small form with two radio buttons and a textarea.The two radio buttons have images associated to them.When a user selects a radio button, then the textarea is updated with the approrate string.I'm not sure what to look for. OnClick? and then somehow update the document.ElementId with text I need in the textarea?The idea is:User selects a logo, the HTML code for the selected image is created and presented to the user via the textarea.:) Quote Link to comment Share on other sites More sharing options...
pr0x Posted December 14, 2006 Share Posted December 14, 2006 yes, Onclick would be the correct command, and everything must have a name, for instance, the form must be named. then name the text area box. Then the command would look something like OnClick="document.formname.textarea.value='data'" Quote Link to comment Share on other sites More sharing options...
artacus Posted December 14, 2006 Share Posted December 14, 2006 [code]<input type="radio" name="imgPicker" value="1" onClick="setImg(this);" />function setImg(rbtn) {var targBox = document.getElementById('myTextField'); if(rbtn.value == 1) { targBox.value = '<img src="img1.png">'; } else { targBox.value = '<img src="img2.png">'; }}}[/code] Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 15, 2006 Share Posted December 15, 2006 I would use getElementById('the_textarea_id').innerHTML instead. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted December 15, 2006 Author Share Posted December 15, 2006 What does .innerHTML do? Quote Link to comment Share on other sites More sharing options...
fenway Posted December 16, 2006 Share Posted December 16, 2006 I didn't think TEXTAREAs had innerHTMLs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.