Home  >  Article  >  Web Front-end  >  js method to change the shape and style of the mouse_javascript skills

js method to change the shape and style of the mouse_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:54:011464browse

Most browsers today support the following pointer styles (move your mouse over the style name to see the pointer style change to that style):
auto move no-drop col-resize
all-scroll pointer not-allowed row-resize
crosshair progress e-resize ne-resize
default text n-resize nw-resize
help vertical-text s-resize se-resize
inherit wait w-resize sw-resize
at Windows internet explorer 6.0 or later, the above pointer style is as follows:
js method to change the shape and style of the mouse_javascript skills

To change the mouse pointer style of an element through script, you can set the element's attribute element.style.cursor for any of the above values. (Another method without JavaScript, you can use attributes in the html tag of the element):

Copy the code The code is as follows:

function setcursorbyid(id,cursorstyle) {
if (document.getelementbyid) {
if (document.getelementbyid(id).style) {
document.getelementbyid(id) .style.cursor=cursorstyle;
}
}
}

Add a commonly used method to change the mouse style: if you want to move the mouse to an element and change the mouse To style, add cursor: (the style you want to change) to the style of this element.
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