Copy code code as follows:
<script language= "javascript" src= "Js/settags.js" > </script>
Function apptag (tagcode)
{
document. postmessage.message.value += tagcode;
}
Function inserttag (Tagbegin, Tagend)
{
if (document.selection) && (document.selection.type == "Text") {
var range = document.selection.createrange ();
var ch_text=range.text;
range.text = tagbegin + ch_text + tagend;
}
else
{
document. Postmessage.message.value=tagbegin+document. postmessage.message.value+tagend;
document. PostMessage.Message.focus ();
}
}
</script>
Call:
Icon button to perform action:
<a href= "Javascript:apptag (' [ImgFace1] ')" ></a>
<a href= "Javascript:inserttag (' [b] ', ' [/II] ')" ></a>
where [imgface1],[b],[/b] is the text you want to insert
var range = Document.selection.createRange ();
var Ch_text=range.text;
This is the text box selected
The text box being manipulated:
<asp:textbox id= "message" runat= "Server" maxlength= "textmode=" "MultiLine" "rows=" width= "100%"/>