Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How to change the cursor
Old 08-07-2007, 07:12 PM How to change the cursor
Nathand's Avatar
Extreme Talker

Posts: 233
Location: USA
Trades: 0
Hi, I'm trying to change the cursor when it's over an image. So I have the following code:

Code:
<script type="text/javascript">

function cursorhand()
{
    document.body.style.cursor = "hand";
}

function cursordefault()
{
   document.body.style.cursor = "default";
}
</script>

<img onMouseover="cursorhand()" onMouseout="cursordefault()" onclick="prev()" src="prev.png">
&nbsp; &nbsp;
<img onMouseover="cursorhand()" onMouseout="cursordefault()" onClick="next()" src="next.png">
That works as expected in IE, but not in Firefox Is there a way to make this work in Firefox?

Thanks,
Nathan
Nathand is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-07-2007, 07:57 PM Re: How to change the cursor
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
I've never tried this, but this CSS pseudo-class may work instead:
[code]
img:hover {
cursor: hand;
}
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-07-2007, 09:39 PM Re: How to change the cursor
Nathand's Avatar
Extreme Talker

Posts: 233
Location: USA
Trades: 0
I'm afraid that's not working for me either.
Nathand is offline
Reply With Quote
View Public Profile
 
Old 08-08-2007, 02:52 AM Re: How to change the cursor
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Again, I'm guessing...but why not?
<img onMouseover="cursorhand('previous')" onMouseout="cursordefault()" onclick="prev()" src="prev.png" id="previous">

function cursorhand(imgId)
{
document.getElementById(imgId).style.cursor = "hand";
}

That get you any closer?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-08-2007, 11:55 AM Re: How to change the cursor
bas
Super Talker

Posts: 108
Name: Bas
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
I've never tried this, but this CSS pseudo-class may work instead:
Code:
img:hover {
     cursor:  hand;
}
try "pointer" instead
(and without :hover, so it works also in older browsers)

Code:
img {
     cursor: pointer;
}
(or with javascript of course)

Last edited by bas; 08-08-2007 at 12:05 PM.. Reason: forgetting al kind of things
bas is offline
Reply With Quote
View Public Profile
 
Old 08-08-2007, 02:40 PM Re: How to change the cursor
Nathand's Avatar
Extreme Talker

Posts: 233
Location: USA
Trades: 0
I changed

Code:
document.body.style.cursor = "hand";
to

Code:
document.body.style.cursor = "pointer";
and it works!

I dunno why the "hand" option even exists, as it only worked in IE, and "pointer" works in both.

Thanks for the help everyone!
-Nathan
Nathand is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to change the cursor
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.28729 seconds with 12 queries