Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Error Try Throw Catch

  <body>



	<div id="error"> </div> 

	<script>


		try{	
		if(x==1)
		{
		throw "x must not be 1";
		}
		}
		catch(err)
		{
		document.getElementById("error").innerHTML = err;
		}
		
		
		</script>
  </body>
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #Error #Try #Throw #Catch
ADD COMMENT
Topic
Name
1+8 =