views:

135

answers:

0

i have selected text from range object. is it possible to "select" text again, using the range object, if i deselect it (click somewhere) ? text is in iframe. thanks, here is code:

 var iframe_window = window.frames["iView"];
  iframe_content = iframe_window.document.getElementsByTagName("body")[0].innerHTML;
  iframe_document = iframe_window.document;



  if (iframe_document.getSelection) {
var str = iframe_document.getSelection();
if (window.RegExp) {
  var regstr = unescape("%20%20%20%20%20");
  var regexp = new RegExp(regstr, "g");
  str = str.replace(regexp, "");


 }
  } else if (iframe_document.selection && iframe_document.selection.createRange) {
   var range = iframe_document.selection.createRange();
   var str = range.text;
  }