Reply Wed 26 Oct, 2011 08:35 pm
I'm trying to add an event handler for to my body, and for some reason which I can't figure out, it only works on Google Chrome. I wouldn't expect it to work in IE, but am wondering why it's not working in Firefox.

Here's the relevant parts of the code:

Javascript (in an external file)

Code:var body = document.body;
body.addEventListener("load", Foo(), false);

function Foo(){
addEventListener(document.getElementsByName("start"),"click", alert("hello"), false);
}

HTML
Code:
<html>
<head>
<title>BREAKOUT!</title>
<script src="breakout.js" type="text/Javascript" >
</script>
<LINK REL="stylesheet" HREF="breakout.css" TYPE="text/css">
</head>

<body id="body">
<!-- etc.... -->
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 947 • Replies: 0
No top replies

 
 

Related Topics

In How much time a website can be developed? - Question by aussiejumpingcastle
Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » addEventListener issue
Copyright © 2019 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 10/19/2019 at 05:50:34