PDA

View Full Version : using attachEvent function with args?


frontline
05-19-2003, 01:24 PM
hello
im using the attachEvent method the problem is that im trying to attach function to event with args in the function
but i don't find any way to do it but attaching pointer to function with out args ..
is there any way to attach to event function with args?
thanks

jkd
05-19-2003, 08:51 PM
document.addEventListener("load", function(event) { myOwnFunction(event, somethingelse, bla, true) }, false);

frontline
05-20-2003, 08:21 AM
is it vaild for MS IE 5.5+?
i can't find it in msdn ......

brothercake
05-20-2003, 12:21 PM
addEventListener is the valid way of attaching events - but it doesn't work in IE.

IE's attachEvent is a proprietary method for doing the same thing, and you can bind an anonymous function to it in pretty much the same way:

document.attachEvent("onload", function(event) { myOwnFunction(event, somethingelse, bla, true) } );