471,338 Members | 992 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

style.cursor in IE5

Further to my hassles with IE5, I think I've narrowed (one of) the
problems down to lines that try to set a cursor property. For example:

obj[1].style.cursor = "pointer";

This code works in IE 5.5+, MZ and FF. Is there something I can do to
get it to work in IE5?

Andrew Poulos
Jul 23 '05 #1
3 1786
Andrew Poulos wrote:
Further to my hassles with IE5, I think I've narrowed (one of) the
problems down to lines that try to set a cursor property. For example:

obj[1].style.cursor = "pointer";

This code works in IE 5.5+, MZ and FF. Is there something I can do to
get it to work in IE5?

Andrew Poulos


Dang, I just realised that "pointer" may be an invalid value for IE5
cursors. If it is, what's a cross browser solution?

Andrew Poulos
Jul 23 '05 #2
On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <ap*****@hotmail.com>
wrote:

[snip]
Dang, I just realised that "pointer" may be an invalid value for IE5
cursors. If it is, what's a cross browser solution?


To use the proper value, however if you need this to work, you might try:

<script type="text/javascript">
var cursor = 'pointer';

function myFunction() {
/* ... */
object.style.cursor = cursor;
/* ... */
}
</script>

<!--[if lt IE 6]>
<script type="text/javascript">
/* Redefine the property value for
* IE versions earlier than 6
*/
cursor = 'hand';
</script>
<![endif]-->

As long as the second code block executes before the function, IE 5.5 and
earlier will use 'hand' rather than 'pointer'.

Hope that helps,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
Michael Winter wrote:
On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <ap*****@hotmail.com>
wrote:

[snip]
Dang, I just realised that "pointer" may be an invalid value for IE5
cursors. If it is, what's a cross browser solution?

To use the proper value, however if you need this to work, you might try:

<script type="text/javascript">
var cursor = 'pointer';

function myFunction() {
/* ... */
object.style.cursor = cursor;
/* ... */
}
</script>

<!--[if lt IE 6]>
<script type="text/javascript">
/* Redefine the property value for
* IE versions earlier than 6
*/
cursor = 'hand';
</script>
<![endif]-->

As long as the second code block executes before the function, IE 5.5
and earlier will use 'hand' rather than 'pointer'.


Thanks it looks like exactly what I need. I was going to do some browser
sniffing but now I don't need to.

Andrew Poulos
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Csaba2000 | last post: by
1 post views Thread by Yaron Cohen | last post: by
18 posts views Thread by Randall Sell | last post: by
1 post views Thread by nikki.farrah | last post: by
1 post views Thread by whitelined | last post: by
4 posts views Thread by datvong | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.