[thelist] Rollovers without links

Aylard JA (James) jaylard at equilon.com
Wed Jul 19 14:20:30 CDT 2000


> <img src="yourimagerollover.gif"
onmouseover="this.style.cursor='default'">
> 
> I am assuming though you would have to add that onmouseover action to your
> rollover script or put it somewhere.

	Actually, you don't need an event handler to set the cursor for an
element. Just set it up like this:

<a href="#null" onclick="fnOpenMenu();">
  <img src="Image.gif" style="cursor:default;">
</a>

	Of course, even better would be to set a class on your <img>
elements and set the cursor in either an embedded or linked style sheet,
rather than inline. As has been stated, this works in IE4+. It also works in
Mozilla/Netscape 6.

<tip type="CSS 'hand' cursor in both IE and Mozilla">
	Both IE4+ and Mozilla support the CSS2 cursor property, allowing you
to change the cursor to one of several predefined cursors (CSS2 actually
provides for the use of unique cursors specified by URL, but neither IE nor
Mozilla appears to support this at present). One problem: if you want to
display the ubiquitous hyperlink "hand", IE and Mozilla use a different
value for this cursor. IE uses "hand" whereas Mozilla uses the
CSS2-compliant "pointer". So what if you want the hand to appear in both
browsers? A couple of possibilities:
	1) declare two style sheets in your document, and add the
IE-proprietary attribute "disabled" to the second style sheet. Place the IE
"cursor: hand;" declaration in the first style sheet, and the CSS2 "cursor:
pointer;" in the second style sheet. Due to cascading precedence, Mozilla
will display the second declaration; because it is marked disabled, IE will
ignore the second declaration, e.g. :

<style type="text/css">
...
</style>
<style type="text/css" disabled>
...
</style>

	2) Wrap your content within a span element and apply the second
declaration to the span, such as:

<div style="cursor: hand;"><span style="cursor: pointer;">Give me a
hand!</span></div>
</tip>

hth,
James Aylard
jaylard at equilon.com




More information about the thelist mailing list