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.:) Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/ 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'" Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/#findComment-141366 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] Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/#findComment-141369 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. Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/#findComment-141732 Share on other sites More sharing options...
SharkBait Posted December 15, 2006 Author Share Posted December 15, 2006 What does .innerHTML do? Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/#findComment-141791 Share on other sites More sharing options...
fenway Posted December 16, 2006 Share Posted December 16, 2006 I didn't think TEXTAREAs had innerHTMLs. Link to comment https://forums.phpfreaks.com/topic/30681-need-a-push-start/#findComment-142143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.