Unstoppable Domains

Cannot assign a function to JavaScript event

Spaceship Spaceship
Watch

vilstewart

Established Member
Impact
1
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.

Any suggestions ? Thanks a lot guys :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back