Use Confirm dialog in if statement : confirm « Dialogs « 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>








13.2.confirm
13.2.1.Confirm dialog
13.2.2.Confirm dialog returns boolean value
13.2.3.Use Confirm dialog in if statement
13.2.4.Use confirm method in if statement