Tag Archives: dom

Passing Parameters to a Function on HTML Events

Let’s say I have some function foo that needs to be called when some HTML element is clicked: function foo(a, b) { : : : } : i = 100; j = 200; element.setAttribute(“onclick”, “foo(i, j)”); In the example above, the Javascript interperter will see the line element.setAttribute(“onclick”, “foo(i, j)”); and automatically figure out that [...]

Posted in Javascript, Tech | Also tagged , , , , , , | Leave a comment