Event Handler code can be assigned to an element event property.
<script>
function DoIt(event)
{
location.href = "5InlineEvent.html";
}
// TestButton is the id of the button element.
// This code must be run after the button is created.
TestButton.onclick = DoIt;
// Another way to do this is with an anonymous method.
// An anonymous method cannot be used from anywhere else.
TestButton.onclick = function (event)
{
location.href = "5InlineEvent.html";
}
// Another way to create an anonymous method.
TestButton.onclick = (event) =>
{
location.href = "5InlineEvent.html";
}
</script>