jnscollier
01-26-2008, 06:06 PM
Ok, so I have a textarea in which i'm displaying some very basic html code. I have it so that if the user clicks in the textarea it selects all the text and then the user can copy and paste it into wherever.
I'm using the following code for that...
<script type="text/javascript">
function select_all()
{
var text_val=eval("document.form1.type");
text_val.focus();
text_val.select();
}
</script>
<form name="form1" method=post>
<textarea name=type rows="5" cols="35" onClick="select_all();">
<html><head><title>Help!</title></head><body>Please help!</body>
</textarea>
</form>
ok, so that all works fine. I want to add three checkboxes now as "additional options" and when a user clicks any of the three (and they can select all three if they want) it should append the html code associated with that checkbox to the bottom of the code in the textarea. If the user unchecks it, I want that code to be removed from the textarea. I am pretty sure I need javascript for this but I can't seem to find examples with textareas or the code disables my select all function. Is there anyway to accomplish this and still keep the select all? Can anyone please help me? Thanks in advance!
I'm using the following code for that...
<script type="text/javascript">
function select_all()
{
var text_val=eval("document.form1.type");
text_val.focus();
text_val.select();
}
</script>
<form name="form1" method=post>
<textarea name=type rows="5" cols="35" onClick="select_all();">
<html><head><title>Help!</title></head><body>Please help!</body>
</textarea>
</form>
ok, so that all works fine. I want to add three checkboxes now as "additional options" and when a user clicks any of the three (and they can select all three if they want) it should append the html code associated with that checkbox to the bottom of the code in the textarea. If the user unchecks it, I want that code to be removed from the textarea. I am pretty sure I need javascript for this but I can't seem to find examples with textareas or the code disables my select all function. Is there anyway to accomplish this and still keep the select all? Can anyone please help me? Thanks in advance!