/    Sign up×
Community /Pin to ProfileBookmark

Javascript event error

Hi,

I’m not sure what I did wrong with this but this doesn’t want to work. I follow the guideline of addEventListener perfectly but for some reason the addEventListener just doesn’t want to get execute. Any idea?

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Untitled Document</title>

<script type=”text/javascript”>
document.addEventListener(“load”, countdown, true);
<!–
var start = 5;
var timer = start;
function countdown(){
if(timer > 0){
timer -= 1;
setTimeout(“countdown()”,1000);
}
else{
location.href=”http://ken.webster.org/“;
}
}
//–>
</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>

</head>

<body></body>
</html>

Thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JPnycDec 05.2004 — What does "document.value" reference?
Copy linkTweet thisAlerts:
@GxpauthorDec 05.2004 — That reference to nothing. I remove it. ?

Any idea why addEventListener is not listening?
Copy linkTweet thisAlerts:
@JPnycDec 05.2004 — You didn't reference a tag, so it doesn't know what you want the event listener attached to. Look [URL=http://www.mozilla.org/docs/dom/domref/dom_el_ref31.html]here[/URL]
Copy linkTweet thisAlerts:
@GxpauthorDec 05.2004 — I think i've figured it out. Thanks.
×

Success!

Help @Gxp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...