on click set html code in form

W

Wouter

Hi,

I'm building a CMS (PHP). But i have a problem whit because i can't make the
javascript that i need.

I want that when i click on a link of a image, that then in a textearea the
code for a image is showen.

Is there some who can help whit this ?

Greets Wouter
 
W

Wouter

<img src="...." onclick="showSource(this.src)">

function showSource(imageSRC){
document.myForm.myTextArea.value = '<img src="' + imageSRC + '">';
}

<form name="myForm">
<textarea name="myTextArea"></textarea>
</form>

That is a start. If you can write PHP then you can add the rest to the img
tag. Just use + instead of . for concatenation of strings.

Thanks for your answer! First sorry for my late reply. But i have some
internet connection troubles here.

Something like that is whet i need. But only i can now click on a image. I
want that i can click on en link becuase want to make that i can place a
image on the right, left or center.

I have tryed to do something like your example. But is doen't work.

<a href=http://www.google.nl/>google.nl</a>
<script language="javascript">
function showSource(imageSRC){
document.myForm.myTextArea.value = '<img src="' + imageSRC + '">';
}
</script>
<form name="myForm">
<textarea name="myTextArea"></textarea>
</form>

Greets Wouter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top