<html>
<script language="JavaScript" type="text/JavaScript">
function sendText(e, text)
{e.value=e.value + text;}
</script>
<body>
<img name="image" width="300" height="200" onClick="sendText(document.form1.taupdate, '<font color=red>')">
<br>
<form name="form1" method="post" action="">
<textarea name="taupdate" cols="30" id="taupdate"></textarea>
</form><
</body></html>
[web] Inserting objects into textarea's
I've searched around for a couple of hours, and I can't find what I need, or it is way too complex. How can I insert a specific tag at the cursors position by clicking a button?
This adds text to the end of it, but how can I add text to wherever the cursor is?
I have personally never seen it done. Looks like your users are just going to have to cut and paste the tags to get them where they want them.
It's possible. Take a look at the javascript in the "new topic/post reply" form on any phpBB powered website (like, for example, phpBB's own site).
You can actually insert text where the cursor is. Visit http://www.alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement