JAVAScriptdocument. selection. createRange method

Source: Internet
Author: User
The document. selection. createRange () method returns a TextRange object based on the selected text or a ControlRange object based on the selected control. With execCommand, you can do a lot of things in the HTML editor, such as bold text, italic, copying... SyntaxHighlig

The document. selection. createRange () method returns a TextRange object based on the selected text or a ControlRange object based on the selected control.
With execCommand, you can perform many tasks in the HTML editor, such as bold text, italic text, copying, pasting, and hyperlink creation.
 
Instance 1:
<Br/> test content!

 
Example 2:

There is a piece of text in the text field. When you select a few words and click a button or link, a dialog box will pop up, the information in the dialog box is the selected text. <br/> which of the following statements can solve the problem? Please help me more !!! Thank you <br/>



There is a piece of text in the text field. When you select a few words and click a button or link, a dialog box will pop up, the information in the dialog box is the selected text. <br/> which of the following statements can solve the problem? Please help me more !!! Thank you <br/>

 
Example 3: select text in Input
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.