Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Onclick event in Netscape and Firefox

Status
Not open for further replies.

dev2006v2

Programmer
Joined
Feb 17, 2006
Messages
5
Location
US
Hello
Onclick event on a label works correctly for IE but not for Netscape and Firefox. I already wrote extensive code for IE so I don't want to change much code. My understanding is that Netscape and Firefox doesn't support onclick. What is the best way around this???
Thank you.
 
My understanding is that Netscape and Firefox doesn't support onclick
This is not the case. Both support onclick with no problems at all. Use this example on your various test browsers to confirm this:
Code:
<html>
<head><title>Test</title>
<script type="text/javascript">
function hello() {
  alert('Hello world');
}
</script>
</head>
<body>
<div onclick="hello();">Click me</div>
</body>
</html>
Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
As Jeff says, both NN and Fx support the onclick event. Maybe you can post the code you're specifically having problems with?

Maybe it's your code. Maybe it's badly written to support IE-only properties or objects (such as the global event object). But whatever it is, it's not lack of support for the browsers you mention.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top