Javascript Problem

Status
Not open for further replies.

smartydebater

Baseband Member
Messages
39
Ok I have a slight dilema here. I have a page that looks like this:

<input type=checkbox name="1" />This will add a certain image to your source code.

<input type=checkbox name="2" />This will add a certain image to your source code.

<button onclick="">Get Your Source Code</button>




<textarea name="source"></textarea>

I've been trying to figure out a way to have a custom function execute when u click the "Get Your Source Code" button. The custom function would check and if checkbox 1 was checked it would add <img src...> to the textarea named source. And so on.... Does anybody see an easy way that this could be done?
 
Code:
<script>
function insert_link()
{
var link = "text here";

document.formname.source.value+=link;

}</script>

that'll add your text to the textarea. you have to replace formname.

rewrite the code to add a check to find out which boxes are checked; select case would prolly work best. add insert_link(); to the button's onclick
 
Status
Not open for further replies.
Back
Top Bottom