Jump to content

Buttons


mortalc

Recommended Posts

Set the onclick handler of the "button" (it doesn't have to be a <button>) to run your function.

document.getElementById("button").onclick = function() {	do_maths();}

Link to comment
Share on other sites

Bind the onclick event of the button to a function, which can be done most easily in the button element:<input type="button" onclick="myFunction()" />And then in myFunction() you can do whatever you want to do.Edit: or attach the handler in script as Synook demonstrated, which is considered best practice anyway :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...