<html> <head> <title>study</title> <meta http-equiv="content-type" content="text/html;charset=gb2312" /> <mce:script type="text/javascript" language="javascript"><!-- window.onload=function(){ try{ alert(aaa); //这是一个不存在的变量 } catch(exception){ var oErr=""; for(var i in exception){ oErr+=i+":"+exception+"/n"; } alert(oErr); } } // --></mce:script> </head> <body> </body> </html> 结果: name:TypeError message:'aaa'未定义 number:-2146823279 description:'aaa'未定义