11-21-2007, 10:40 PM
| THREAD STARTER
#1 (permalink)
|
| NamePros Member Join Date: Jun 2007 Location: Mississippi, US
Posts: 30
| Cannot assign a function to JavaScript event; o_O. Alright, well I am trying to assign a function to a JavaScript Event for a retrieved element.
I will explain with code first : Code:
window.onload = function() {
var divBox = document.getElementById(someid)
var divBox.onclick = someOtherFunction(arg,arg)
}
function someOtherFunction(arga,argb){
var anotherDiv = document.getElementById(someid)
anotherDiv.style.color='blue'
} If I attempt to do something similar to the above code, it executes 'someOtherFunction' rather than just setting the onclick event to the function with the proper arguments that I need to send it. ????: NamePros.com http://www.namepros.com/programming/398460-cannot-assign-function-javascript-event-o_o.html
Any suggestions ? Thanks a lot guys |
| |