Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-26-2006, 08:55 PM   #1 (permalink)
 
Newb Techie

Join Date: Jan 2006

Posts: 39

smartydebater

Default Javascript Problem

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?
smartydebater is offline  
Old 03-26-2006, 09:50 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

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
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On