Write a JavaScript program using Exception handling?

Program: <html> <head> <script type="text/javascript"> var txt=""; function message() ...

Program:
<html>

<head>

<script type="text/javascript">
var txt="";
function message()
{
try
  {
  alert("Welcome guest!");
  }
catch(err)
  {
  txt="There was an error on this page.\n\n";
  txt+="Error description: " + err.description + "\n\n";
  txt+="Click OK to continue.\n\n";
  alert(txt);
  }
}
</script>

</head>

<body>

<input type="button" value="View message" onClick="message()" />

</body>

</html>

Out Put:

exception handling

Related

Web Technology 9012772127111898776

Post a Comment

emo-but-icon

item