cursor type

Discussion in 'Javascript' started by olimoli, Jan 6, 2004.

  1. olimoli

    olimoli Guest

    Hi,

    I have a problem changing the cursor type with javascript. I have a
    button with an mouseover effect (change of color and cursor type). It
    works fine in Netscape 7.x and IE 6.x but not in IE 5.5 I'm using the
    following script:

    function change(element,mode) {
    if (mode=="in") {
    cursortype = 'pointer'
    colorval = '#FF491B'
    } else if (mode=="out") {
    cursortype = ''
    colorval = '#F47240'
    }
    element.style.cursor=cursortype;
    element.style.background=colorval;
    }

    The error I'm getting with IE 5.5 is "cursor type not defined..." or
    something but the pointer is supposed to work even with IE 4.x

    Does anybody has a solution for this problem?
    Thanks!
    Cheers Olaf
     
    olimoli, Jan 6, 2004
    #1
    1. Advertising

  2. olimoli

    McKirahan Guest

    "olimoli" <> wrote in message
    news:...
    > Hi,
    >
    > I have a problem changing the cursor type with javascript. I have a
    > button with an mouseover effect (change of color and cursor type). It
    > works fine in Netscape 7.x and IE 6.x but not in IE 5.5 I'm using the
    > following script:
    >
    > function change(element,mode) {
    > if (mode=="in") {
    > cursortype = 'pointer'
    > colorval = '#FF491B'
    > } else if (mode=="out") {
    > cursortype = ''
    > colorval = '#F47240'
    > }
    > element.style.cursor=cursortype;
    > element.style.background=colorval;
    > }
    >
    > The error I'm getting with IE 5.5 is "cursor type not defined..." or
    > something but the pointer is supposed to work even with IE 4.x
    >
    > Does anybody has a solution for this problem?
    > Thanks!
    > Cheers Olaf



    If "mode" is neither "in" or "out" then "cursortype" will not be defined.

    You might want to use this snippet:

    if (mode=="in") {
    cursortype = 'pointer';
    colorval = '#FF491B';
    } else {
    cursortype = '';
    colorval = '#F47240';
    }
     
    McKirahan, Jan 6, 2004
    #2
    1. Advertising

  3. olimoli

    DU Guest

    McKirahan wrote:
    > "olimoli" <> wrote in message
    > news:...
    >
    >>Hi,
    >>
    >>I have a problem changing the cursor type with javascript. I have a
    >>button with an mouseover effect (change of color and cursor type). It
    >>works fine in Netscape 7.x and IE 6.x but not in IE 5.5 I'm using the
    >>following script:
    >>
    >>function change(element,mode) {
    >>if (mode=="in") {
    >> cursortype = 'pointer'
    >> colorval = '#FF491B'
    >>} else if (mode=="out") {
    >> cursortype = ''
    >> colorval = '#F47240'
    >>}
    >>element.style.cursor=cursortype;
    >> element.style.background=colorval;
    >>}
    >>
    >>The error I'm getting with IE 5.5 is "cursor type not defined..." or
    >>something but the pointer is supposed to work even with IE 4.x
    >>
    >>Does anybody has a solution for this problem?
    >>Thanks!
    >>Cheers Olaf

    >
    >
    >
    > If "mode" is neither "in" or "out" then "cursortype" will not be defined.
    >
    > You might want to use this snippet:
    >
    > if (mode=="in") {
    > cursortype = 'pointer';
    > colorval = '#FF491B';
    > } else {
    > cursortype = '';
    > colorval = '#F47240';
    > }
    >
    >



    cursortype = "auto";
    instead of
    cursortype = '';
    is slightly better (more robust; parsing related) IMO.

    DU
     
    DU, Jan 6, 2004
    #3
  4. olimoli

    Keith Bowes Guest

    olimoli wrote:
    > Hi,
    >
    > I have a problem changing the cursor type with javascript. I have a
    > button with an mouseover effect (change of color and cursor type). It
    > works fine in Netscape 7.x and IE 6.x but not in IE 5.5 I'm using the
    > following script:
    >
    > function change(element,mode) {
    > if (mode=="in") {
    > cursortype = 'pointer'
    > colorval = '#FF491B'
    > } else if (mode=="out") {
    > cursortype = ''
    > colorval = '#F47240'
    > }
    > element.style.cursor=cursortype;
    > element.style.background=colorval;
    > }
    >
    > The error I'm getting with IE 5.5 is "cursor type not defined..." or
    > something but the pointer is supposed to work even with IE 4.x
    >
    > Does anybody has a solution for this problem?


    IE 4.0 through 5.5 didn't support the cursor type 'pointer' (only the
    non-standard 'hand').
     
    Keith Bowes, Jan 6, 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,378
    Bruce Barker
    Apr 5, 2005
  2. invy
    Replies:
    4
    Views:
    422
    CBFalconer
    Dec 28, 2006
  3. Paul O'Sullivan
    Replies:
    2
    Views:
    1,122
    Lie Ryan
    Nov 29, 2009
  4. dmaziuk
    Replies:
    3
    Views:
    631
    Chris Gonnerman
    Jan 25, 2011
  5. +Bob+
    Replies:
    4
    Views:
    422
    Bob Barrows [MVP]
    Nov 29, 2006
Loading...

Share This Page