style.cursor in IE5

Discussion in 'Javascript' started by Andrew Poulos, Dec 8, 2004.

  1. 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
    Andrew Poulos, Dec 8, 2004
    #1
    1. Advertising

  2. 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
    Andrew Poulos, Dec 8, 2004
    #2
    1. Advertising

  3. On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <>
    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.
    Michael Winter, Dec 8, 2004
    #3
  4. Michael Winter wrote:
    > On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <>
    > 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
    Andrew Poulos, Dec 9, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VG9tYXMgS2VwaWM=?=

    Changing DEFAULT cursor to WAIT cursor in ASP

    =?Utf-8?B?VG9tYXMgS2VwaWM=?=, Apr 5, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,287
    Bruce Barker
    Apr 5, 2005
  2. Tom
    Replies:
    0
    Views:
    1,018
  3. invy
    Replies:
    4
    Views:
    374
    CBFalconer
    Dec 28, 2006
  4. dmaziuk
    Replies:
    3
    Views:
    544
    Chris Gonnerman
    Jan 25, 2011
  5. McKirahan

    "cursor:pointer" re IE5.5

    McKirahan, Jan 19, 2005, in forum: Javascript
    Replies:
    3
    Views:
    117
    McKirahan
    Jan 19, 2005
Loading...

Share This Page