Hi,

I have with javascript in a struts application. I am trying to insert a text into a TextArea. Somehow document.selection.createRange().text is not working. I am using IE6.0.29

Below is the code.

<script type="text/javascript" language="javascript">
function addToMessageText(sendText){
      // alert("addToMessageText: "+ sendText);
       var selectedText = document.selection.createRange().text;
       alert("selectedText : "+ selectedText );
       if (selectedText != ""){
              document.selection.createRange().text = sendText ;
       }
   }

</script>

and calling the method from a button. Somehow document.selection.createRange().text is not working.

<a class="linkButton" onclick="addToMessageText('%%FIRSTNAME')" ><bean:message key="label.firstname"/></a>

Any suggestions is appreciated.

Bharathi.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to