style.cursor in IE5

A

Andrew Poulos

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
 
A

Andrew Poulos

Andrew said:
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
 
M

Michael Winter

[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
 
A

Andrew Poulos

Michael said:
[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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top