Welcome to JavaScript Finder
Javascript Functions
A function will not execut a script when the page loads. A function is executed by an event or by a call to that function. You can call a function from anywhere within the page. If the function is embedded in an external .js file it can be called from other pages.
JavaScript : Function
<script language="JavaScript">
<!--
function whatsup() {
alert("Who Let Tha Dogs Out ?")
}
-->
</script>
All the code needs to be in these brackets i.e;{ function code goes in here }. By clicking the button you called an event. But there are many more ways to call the function. I will show you more on the If Statement Page.
JavaScript : Call Function
<html>
<head>
<script type="text/javascript">
<!--
function whatsup() {
alert("Who Let Tha Dogs Out ?")
}
//-->
</script>
</head>
<body>
<input type="button" onclick="whatsup()" value="whatsup">
</body>
</html>
Try it out.