Home Web Front-end JS Tutorial Summary of some cursor operations_javascript skills

Summary of some cursor operations_javascript skills

May 16, 2016 pm 07:25 PM
cursor

The Range operation under IE is much better than that under Mozilla. Here we only discuss the operation under IE.
Here are a few features of cursor positioning:

1. The cursor remains unchanged

Direct obj.focus(), the cursor will return to the previous position. That is, the position remains unchanged

2. The cursor is at the front

Copy code The code is as follows:

var r = obj.createTextRange();
r.collapse();
r.select();

Use this The method can put the cursor at the front of the input box

3. The cursor is at the end

Copy code The code is as follows:

var r = obj.createTextRange();
r.collapse(false);
r.select();

Use this method to make the cursor stop at the end of the input box

4. To select part of the content in the input box, you need to use the moveStart or moveEnd method of Range. For detailed methods, please refer to MSDN.


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

5. Let’s expand on the movement and position of the cursor. This is a question that people often ask

[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Turn Easy T cursor movement between monitors on or off on Windows 11 Turn Easy T cursor movement between monitors on or off on Windows 11 Sep 30, 2023 pm 02:49 PM

Often, when using a dual monitor setup, the question arises of how to seamlessly move the cursor from one monitor to the other. It can be frustrating when your mouse cursor moves from one monitor to another without your control. Wouldn't it be great if Windows allowed you to easily switch from one monitor to another by default? Luckily, Windows 11 has a feature that does just that, and it doesn't require a lot of technical knowledge to perform it. What does easing cursor movement between monitors do? This feature helps prevent cursor drift when moving the mouse from one monitor to another. By default, this option is disabled. If you turn it on, the mouse

How to solve the problem of black screen and cursor when booting up Windows 7 How to solve the problem of black screen and cursor when booting up Windows 7 Dec 30, 2023 pm 10:25 PM

The Windows 7 system has currently stopped updating, so if there is a problem, you can only solve it yourself. As shown below, there are many situations where the cursor goes black after booting the computer, and you need to troubleshoot one by one. If you don’t want to spend time troubleshooting, you can just reinstall the system. What to do if there is only a black screen with a cursor when Windows 7 starts up? The first solution: Restart the computer, and immediately press and hold the "F8" button on the keyboard after restarting. Then select "Last Known Good Configuration" in the advanced system menu. The second solution: press the shortcut key "CTRL+SHIFT+ESC" to see if the task manager can be brought up. If so, right-click to end Explorer.exe in the process and then create a new run Explorer.exe to try.

How to set the cursor color of Debian 11 Xfce terminal? How to set the cursor color of Debian 11 Xfce terminal? Jan 03, 2024 pm 02:36 PM

What is Xfce? Xfce is a free software that runs on Unix-like operating systems (such as Linux, FreeBSD and Solaris) and provides a lightweight desktop environment. How to adjust the cursor color in Debian11Xfce terminal? Let’s take a look at the specific operations with the editor. Click [Edit]-[Preferences]. Switch to the [Color] tab. Check Customize [Cursor Color] and click the color selection button on the right. After opening the palette, click to select the cursor color you want to set.

What to do if there is no cursor when clicking on the input box What to do if there is no cursor when clicking on the input box Nov 24, 2023 am 09:44 AM

Solutions for clicking the input box without a cursor: 1. Confirm the focus of the input box; 2. Clear the browser cache; 3. Update the browser; 4. Use JavaScript; 5. Check the hardware device; 6. Check the input box properties; 7. Debug JavaScript code; 8. Check other elements of the page; 9. Consider browser compatibility.

What key is used to switch the keypad area between editing functions and cursor control? What key is used to switch the keypad area between editing functions and cursor control? Jul 26, 2021 pm 02:44 PM

The key that enables the keypad area to switch between editing functions and cursor control is NumLock; Numlock refers to locking the numbers. If the Numlock key is canceled on the keyboard, the numbers on the keypad cannot be used.

What to do if linux vi does not display the cursor What to do if linux vi does not display the cursor Mar 22, 2023 am 09:39 AM

Solution to Linux vi not displaying the cursor: 1. Log in to the Linux system and enter the terminal; 2. Display the cursor by executing the "echo -e "\033[?25h"" method.

How to solve Win10 red alert and black screen with only the mouse visible? What should I do if Win10 red alert turns up and the screen is black and only the cursor is visible? How to solve Win10 red alert and black screen with only the mouse visible? What should I do if Win10 red alert turns up and the screen is black and only the cursor is visible? Jul 08, 2023 pm 06:49 PM

Red Alert is a traditional strategy game. Recently, a customer said that when he was playing Red Alert, a black screen occurred. However, he could only see the mouse on the screen and could not continue to play the software if only the cursor was there. Okay, so what should I do if the Win10 red alert shows a black screen with only the cursor visible? The editor below will share with you the solution to the Win10 red alert black screen with only the mouse visible. How to solve the problem of Win10 red alert and black screen, only the computer mouse can be seen? 1. Find the document as shown below in the folder name. 2. Open the shortcut icon and add the "-win" identifier. 3. Click with the mouse to select the document as shown below, and select "Open as text document". 4. Modify the resolution as shown in the figure below.

Detailed explanation of CentOS installation Piwik and solving the problem of only one cursor after CentOS installation Detailed explanation of CentOS installation Piwik and solving the problem of only one cursor after CentOS installation Feb 11, 2024 pm 07:36 PM

Among Linux operating systems, CentOS is a free recompiled Linux distribution based on Red Hat Enterprise Linux (RHEL) source code. It is widely used in server environments and is loved by users for its stability and security. Piwik is a An open source website analysis tool that can be used to track and analyze website access data. This article will introduce in detail how to install Piwik on CentOS and solve the problem of only one cursor after installation. Install Piwik1. Make sure your CentOS system has installed Apache, MySQL and PHP. You can use the following command to install it: ````sudoyuminstallh

See all articles