Javascript examples for Object:Object Method
Get selection object and use its type and toString method
<html> <head></head> <body> eteetetetetete //from w w w .j a v a2 s.c o m <br> Current selection type : <span id="t"></span> <br> Current selection length : <span id="l"></span> <script> setInterval(function(){ var s = window.getSelection(); document.getElementById('t').innerHTML = s.type; document.getElementById('l').innerHTML = s.toString().length; }, 400); </script> </body> </html>