Forum Moderators: open

Message Too Old, No Replies

Change cursor style and background in both Explorer and Netscape?

         

Raymondwu

5:43 am on Jan 15, 2003 (gmt 0)

10+ Year Member



I've writen a js function which can be called to change the mouse cursor style and background color of the <td> on mouseover/mouseout event. It works fine when running in Internet Explorer, but not functioned in Netscape. How can I change the js to enable this effect in Netscape also?

function td_style(itm,bgcol,csstyle)
{
itm.style.backgroundColor = bgcol;
itm.style.cursor = csstyle;
}

:
:
<html>
:
<td class=cattitle bgcolor=yellow id=box1
onmouseover='td_style(gohome,"blue","Hand")'
onmouseout='td_style(gohome,"yellow","Auto")'
onClick='document.location="index.asp"'>
Home
</td>
:
:
:

BlobFisk

10:26 am on Jan 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Raymondwu,

Unfortunately,cursor styles are not supported by Netscape 4, Opera, Safari, iCab and Omniweb, only IE4+ and NN6+.

More information on this can be found here [xs4all.nl] and here [webdesign.about.com].

Raymondwu

3:08 am on Jan 16, 2003 (gmt 0)

10+ Year Member



Thanks a lot! They are really helpful!

Build cross-browser javascript and css is so painful! Why can't they get standardized?

DrDoc

6:49 am on Jan 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



They ARE standardized .. It's just that older browsers don't support all the functions newer browsers support.

Plus, they all have their own "things" ..

Nevertheless, there is a JS standard .. several in fact

Raymondwu

7:57 am on Jan 16, 2003 (gmt 0)

10+ Year Member



Oh! Really? But why the examples still need to check the browser version?

Btw, which browser do you use mostly in your countries? In Hong Kong, I think Internet Explorer is the major. But I'm writing web pages selling goods to overseas, so I need to know which one they use most.

WibbleWobble

2:05 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



hand [w3schools.com] isn't a valid cursor style, anyway. Pointer is the 'correct' style. The latter works in Mozilla at least, which hand doesn't.

DrDoc

6:28 pm on Jan 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First of all, let's not get CSS and JavaScript mixed up. Cursor is CSS, even though it can be changed using JS.

And you usually have to check for browser to make sure you support both newer and older versions.

For example, all newer browsers support document.getElementById(), while older IE support document.all[] .. and old NS support document.layers()

IE has usually more than 90% of the visitors, with all the other browsers sharing the last 10%. However, the actual numbers depend entirely on page content.

If your page supports IE, Opera, and Mozilla/Gecko browsers (and perhaps NS4 as well) you should be mostly safe, especially if your code conforms to W3C standards.

If you want to read more about JS standards you can look here:
[mozilla.org...]
[devedge.netscape.com...]