Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

javascript - How to change cursor style on element with 'contenteditable' attribute in IE?

I am trying to change style of cursor on element that has 'contenteditable' attribute set to true in IE.

<div contenteditable="true" style="cursor:pointer;">
        text
</div>

I have tried do that using inline styling like in example above, also with css file and by javascript but with no luck.

All my solutions work in FF without problems, they work fine also in IE but only when 'contenteditable' attribute is set to false. So it is definitely somehting related with implementation of contenteditable in IE but I have no clue how to solve this problem.

I am using IE8.

Thank a lot for your help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

it depends on your DTD you have chossen. Seems you use default strict DTD.

Here is reference for possible declarations: look to 7.2 HTML version information.

I tried with:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

and it works great, but it don't works with next declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Hope it helpful and you can use that DTD without issues on another layouts.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...