Help needed for replacing selected text

Dear All,

     I am using a Netscape Navigator.

     I am using a Javascript function which should get selected object from the document and replace the same with my new content in the IFRAME with a TextArea.

     I am able to get the Selected Text by using document.getSelection() method.

But how do i replace the selected text with my new content.

Thanks in advance for the replies.

Thanks and Regards,
Santhosh Kumar.M