欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Javascript 學(xué)習(xí)筆記 錯(cuò)誤處理

 更新時(shí)間:2009年07月30日 21:41:04   作者:  
Javascript學(xué)習(xí)筆記:錯(cuò)誤處理.
Java代碼
復(fù)制代碼 代碼如下:

<html>
<head>
<title>javascript</title>
<script type="text/javascript">
function test(inVal){
try{
inVal=inVal.toUpperCase();
}catch(error){
alert("An exception has occurred.Error was:\n\n"+error.message);
}
}
</script>
</head>
<body>
<input type="button" value="Test" onclick="test(null);">
</body>
</html>

復(fù)制代碼 代碼如下:

<html>
<head>
<title>javascript</title>
<script type="text/javascript">
function test(inVal){
try{
inVal=inVal.toUpperCase();
}catch(error){
alert("An exception has occurred.Error was:\n\n"+error.message);
}
}
</script>
</head>
<body>
<input type="button" value="Test" onclick="test(null);">
</body>
</html>

利用firefox的firebug來(lái)調(diào)bug
引用
復(fù)制代碼 代碼如下:

<html>
<head>
<title>javascript</title>
<script type="text/javascript">
function test(){
var a=0;
console.log("checkpoint 1");
a=a+1;
console.log("checkpoint 2");
a=a-1;
console.log("checkpoint 3");
a=a.toLowerCase();
console.log("checkpoint 4");
}
</script>
</head>
<body>
<input type="button" value="Test" onclick="test(null);">
</body>
</html>

在IE中可以添加一個(gè)方法
引用
復(fù)制代碼 代碼如下:

function Console(){
this.log=function(inText){
alert(inText);
}
}
var console=new Console();

相關(guān)文章

最新評(píng)論