style.cursor in IE5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Poulos

    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
  • Andrew Poulos

    #2
    Re: style.cursor in IE5

    Andrew Poulos wrote:
    [color=blue]
    > 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[/color]

    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

    Comment

    • Michael Winter

      #3
      Re: style.cursor in IE5

      On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <ap_prog@hotmai l.com>
      wrote:

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

      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.cu rsor = 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.

      Comment

      • Andrew Poulos

        #4
        Re: style.cursor in IE5

        Michael Winter wrote:[color=blue]
        > On Thu, 09 Dec 2004 10:07:48 +1100, Andrew Poulos <ap_prog@hotmai l.com>
        > wrote:
        >
        > [snip]
        >[color=green]
        >> Dang, I just realised that "pointer" may be an invalid value for IE5
        >> cursors. If it is, what's a cross browser solution?[/color]
        >
        >
        > 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.cu rsor = 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'.[/color]

        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

        Comment

        Working...