Call a function in hyperlink : Function Call « Function « JavaScript Tutorial






<html>
<head>
<title>Calling a Function</title>

<script language="javascript" type="text/javascript">
<!--

function greetVisitor()
{
     var myName = prompt("Name?", "");
     alert("Welcome " + myName + "!")
}

//-->
</script>

</head>
<body>

<h1>Please click below and enter your name when prompted.</h1>

<P><a href="javascript:greetVisitor()">Click for a greeting</a></p>

</body>
</html>








7.5.Function Call
7.5.1.Call your function
7.5.2.Call function inside a function
7.5.3.Call a function in hyperlink
7.5.4.Call your function in body onLoad event
7.5.5.Nested function call
7.5.6.Function call sequence