title: how to get selected text from iframe with javascript?
body: <pre><code>&lt;html&gt;
   &lt;body&gt;
    &lt;script type="text/javascript"&gt;
  
     function smth() {
  
      if (document.getSelection) {
      var str = 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 (document.selection &amp;&amp; document.selection.createRange) {
       var range = document.selection.createRange();
       var str = range.text;
      }   
  
      alert(str);
     }
    &lt;/script&gt;   
  
      &lt;iframe id="my"  width="300" height="225"&gt;
     .....some html ....
      &lt;/iframe&gt;      
  
      &lt;a href="#" onclick="smth();"&gt;AA&lt;/a&gt;
   &lt;/body&gt;    
  &lt;/html&gt;
  </code></pre>
  
  <p>with <code>smth</code> function i can get selected text from some div, but it doesnt work with iframe.
  any ideas how to get selected text from iframe ?</p>