<script language="javascript"> function CopyText(el){ var selectedText = ""; if(window.getSelection){ selectedText = window.getSelection(); }else if(document.getSelection){ selectedText = document.getSelection(); }else if(document.selection){ selectedText = document.selection.createRange().text; } if(selectedText != ""){ selectedText = selectedText.toString(); el.focus(); el.value = selectedText; }else{ alert("Select a text in the page and then press this button!"); } } </script> Select any part of this text to copy it... <form name="frmCopyText"> <textarea name="txtSelect" rows="4" cols="45"></textarea><br> <input onclick="CopyText(this.form.txtSelect)" type="button" value="Press to copy the highlighted text" name="btnCopy"> </form>
Please like or share with friends and don’t forget say hello if you find it interesting, more are still coming to codexpress labs Devs users.
Hit me with a comment!