Jump to content


This topic is now archived and is closed to further replies.


please help *SOLVED*

Recommended Posts

I'am quit new to javascript. I've been trying to solve this little problem myself, but...
here is the problem: I'am making a form where user can insert the image (like bbcode); everything works ok, but I don't want the value to show all the html code: [color=red]<img src="http://www.3d.caucasus.net/pics/bbcode/smile.gif">[/color], I want to dispaly something like: SMILE or something. Thanks for your help, I really need this:(

[color=green]function addHTML(smile) {
document.forms['Input Form']['The_Textarea'].value+='<img src="http://www.3d.caucasus.net/pics/bbcode/smile.gif">';
document.forms['Input Form']['The_Textarea'].focus();

here is the HTML code for image (works ok):

[color=red]<img src="../pics/bbcode/smile.gif" width="50" height="49" onClick="addHTML('smile');">[/color]

Share this post

Link to post
Share on other sites
Hi there,

Not sure to get it all well, (my english) but,...
Maybe if the "destination" is a div/container, instead of a 'textarea', you could have the expected result,
Something like:
html part:
<div id="mydiv"></div>
& js part:
document.getElementById('mydiv').innerHTML="<img src='yoursmile.gif' onclick='whatUwant()'>";
To try,, & hoping it helps,


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.