/    Sign up×
Community /Pin to ProfileBookmark

Event undefined

memberLinks[x].onmouseover=function(){
pullInformation(this, event);
}

Im using that little bit to add an event handler to some links and it works fine until i actually hover over the link. Then it says that event is undefined. Does anyone know a work around to this?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJan 02.2009 — [B]event[/B], as a global variable, only exists in Internet Explorer. Standards browsers pass the event object to the event handler function automatically:
[CODE]memberLinks[x].onmouseover=function([B][SIZE="4"]e[/SIZE][/B]){
[B][SIZE="4"]e = e || window.event;[/SIZE][/B]
pullInformation(this, [B][SIZE="4"]e[/SIZE][/B]);
}[/CODE]
Copy linkTweet thisAlerts:
@posiden5665authorJan 02.2009 — Ahhh thank you very very much.
Copy linkTweet thisAlerts:
@KorJan 03.2009 — I wonder... Do you really need to pass the event to another function? Why?
Copy linkTweet thisAlerts:
@posiden5665authorJan 03.2009 — It will look cleaner plus its gunna be a pretty big function that its calling so I don't wanna try and clutter up the onmouseover I'd rather make it nice and easy to follow for anyone trying to look at it. Plus it will be more effecient since the function is going to be huge to only write one function call then the same function over and over and over again with possibly hundreds of links.
Copy linkTweet thisAlerts:
@toicontienJan 04.2009 — Yeah, I like my event handlers to call additional functions too, so I can more easily separate the code that captures user actions from the code the performs what the user wants.
×

Success!

Help @posiden5665 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.17,
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,
)...