Skip to content

Instantly share code, notes, and snippets.

@jeena
Created September 9, 2010 12:14
Show Gist options
  • Save jeena/571791 to your computer and use it in GitHub Desktop.
Save jeena/571791 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script>
var obj = {
a: 0,
add: function () {
console.log("a: " + this.a);
}
}
function init() {
document.getElementById("foo").onclick = obj.add;
}
</script>
</head>
<body onload="init()">
<p>
<input id="foo" type="button" value="Add">
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment