Home >Web Front-end >JS Tutorial >Usage examples of createTextRange() include selecting part of the text content in the text box_javascript skills

Usage examples of createTextRange() include selecting part of the text content in the text box_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:58:331312browse
Copy code The code is as follows:





Get the selected text in the specified text box: response only The first text box
Copy code The code is as follows:






After focusing on the control, put the cursor at the end
Copy the code The code is as follows:


< ;input type="text" value="http://toto369.net" onfocus="setFocus()">

Get the cursor position in the text box
Copy code The code is as follows:





Control the cursor position in the input box
Copy code The code is as follows:





Select a piece of text in the text box
Copy code The code is as follows:





控制文本框内光标的移动
复制代码 代码如下:





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