aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes On mouse over / On click events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "On mouse over / On click events" Watch "On mouse over / On click events" New topic
Author

On mouse over / On click events

sumanth kadaba
Greenhorn

Joined: Jun 21, 2009
Posts: 27
Hi All,

I am trying to code a html page which is compatible across browsers.

have a look at the code


Pardon me for the coding standards..
Basically my header of the table will contain a link. I planned to make the whole header "clickable".
so on mouse over I change my cursor to hand and then keep an onclick event so that I can navigate to the url.


Now I tested this in

Fire Fox(2,3) : work's fine.
IE (6,7,8): Refuses to behave in the desired fashion.

I did read about this problem, but I was unable to figure out.

I also tried onmouseover instead of onMouseOver, onclick instead of onClick.

Kindly advise on the event handling.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You should not use setAttribute for setting events, an event handler is not an attribute.

Here is how you should add an event if you are not using a library such as jQuery
http://www.scottandrew.com/weblog/articles/cbs-events


BUT there is a better solution, no JavaScript is needed



Pure old CSS


Eric
sumanth kadaba
Greenhorn

Joined: Jun 21, 2009
Posts: 27
Hi Eric,

Yes the CSS technique is there

Will try getting it done in script too.

Thanks,
Kadaba
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: On mouse over / On click events