1.
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>Insert title here</title> 8 <script language="javascript"> 9 <!-- 10 主要利用try catch来打印错误的信息 11 --> 12 function getError() 13 { 14 try 15 { 16 x =new test; //产生错误。 17 } 18 catch(e) 19 { 20 document.write(e.description+"aaaaaa") //打印错误结果. 21 } 22 } 23 </script> 24 </head> 25 <body onload="getError()" > 26 </body> 27 </html>
浙公网安备 33010602011771号