<input id="test" type="text"> <script> function foo1() { alert(1) } function foo2() { alert(2) } test.onclick = foo1; </script>