Page 1 of 1

How to Call a JavaScript function on button click

Posted: Wed Feb 17, 2010 2:46 am
by Neo

Code: Select all

<html>
<head>
<script type="text/javascript">
function displaymessage()
{
alert("Hello World!");
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" onclick="displaymessage()" />
</form>
</body>
</html>