Home >Web Front-end >JS Tutorial >JS implementation returns the selected text based on the current text selection_javascript skills

JS implementation returns the selected text based on the current text selection_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:47:261274browse
Copy code The code is as follows:

<script> <br>function doit(){ <br> newT=document.selection.createRange() <br>clipboardData.setData("Text",newT.text) <br>if(clipboardData.getData("Text")!=null){ <br>document.all.pp .value=clipboardData.getData("Text") <br>} <br>} <br></script>

Add request may occur Change
Expert recommendation and add sorting





test what



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn