<html> <head> <script type="text/javascript"> function getSelectedText() { if (window.getSelection) { // This technique is the most likely to be standardized. // getSelection() returns a Selection object, which we do not document. return window.getSelection().toString(); } else if (document.getSelection) { // This is an older, simpler technique that returns a string return document.getSelection(); } else if (document.selection) { // This is the IE-specific technique. // We do not document the IE selection property or TextRange objects. return document.selection.createRange().text; } }
</script> </head> <body> <!--I included all possible aspects of window.open to show how you can open a javascript window within a link--> <a href="javascript: var q = getSelectedText(); void window.open('http://en.wikipedia.org/wiki/' + q, 'newwindow', config='height=500, width=500, toolbar=no, menubar=yes, scrollbars=yes, resizable=yes, location=no, directories=no, status=no'); "> Look Up Selected Text In Wikipedia </a>
</br> <a href="javascript: var q = getSelectedText(); void window.open('http://www.google.com/search?source=ig&hl=en&q=' + q); "> Search Selected Text In Google </a>
</br> <a href="javascript: var q = getSelectedText(); void window.open('http://www.thefreedictionary.com/' + q); "> Look up meaning in the Dictionary </a>
</br>
</br> Interesting words off the top of my head </br> Wiki </br>Uganda </br>Kampala </br>Mountain Gorilla </br>DMX </br>The Great Depression </br>tree </br>C++ </br>Clinton </br>Garnet </br>Celtics </br>Cape Cod
</body> </html>
|