Return boolean value from function : Function Return « Function « JavaScript Tutorial






<html>
<head>
<script Language="Javascript" type = "text/javascript">
<!--
var newurl

function CheckRequest(newurl)
{
    if (confirm("Do you want to visit " + newurl + " site.")) {
      return true;
    } else {
      return false;
    }
}

//-->
</script>
<title>Capturing Links</title>
</head>
 <P><A href="http://www.java2s.com" onClick = "return CheckRequest('java2s')">Java</A></P>
 <P><A href="http://www.netscape.com" onClick = "return CheckRequest('Netscape')">Netscape</A></P>
</body>
</html>








7.7.Function Return
7.7.1.return
7.7.2.Returning Values
7.7.3.Return value from a function
7.7.4.Return boolean value from function
7.7.5.Return an array from a function