/    Sign up×
Community /Pin to ProfileBookmark

Type of event and target without (e)

eml.onmouseover = function (e) {
if (!e) var e = window.event;
var evnt = e.type;
var target = event.target || event.srcElement;
}
will get the get the event and the target, but how can I get the same result without having an e on the

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 28.2008 — You mean<i>
</i>eml.onmouseover = function () {
var e = window.event||arguments[arguments.length-1];
var evnt = e.type;
var target = event.target || event.srcElement;
}
Copy linkTweet thisAlerts:
@felgallJun 28.2008 — That just makes the code longer without making any other difference whatever except for saving you the trouble of remembering where to put the e when there are other parameters passed as well.
Copy linkTweet thisAlerts:
@Declan1991Jun 28.2008 — That just makes the code longer without making any other difference whatever except for saving you the trouble of remembering where to put the e when there are other parameters passed as well.[/QUOTE]
Well it does, and I've never had a reason to use it, but maybe this user has (though I doubt it).
Copy linkTweet thisAlerts:
@bialeckiJun 29.2008 — I agree here. You should always be explicit about what arguments you are expecting so if someone (probably you) has to change the function a while down the line, they know what arguments they can expect.

Well it does, and I've never had a reason to use it, but maybe this user has (though I doubt it).[/QUOTE]
×

Success!

Help @Tabo 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 5.29,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...