i did it like this... and its working crossbrowser..
but.. it's adding tags to the before/after to all writtens in textarea... (document.getElementById('textarea'))
It must add the tags before/after to the only sellected words..
could someone help me?
Code:
<script type="text/javascript">
<!--
function addtag(p_oObj, p_sText) {
p_oObj.value = '[' + p_sText + ']' + p_oObj.value + '[/' + p_sText + ']';
}
//-->
</script>
<button onclick="addtag(document.getElementById('textarea'),'b')">B</button><br/>
<textarea id="textarea" name="message" style="resize: vertical;" rows="12" cols="48"></textarea>
Bookmarks