国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

Javascript 學習筆記 錯誤處理

2019-11-21 01:13:35
字體:
來源:轉載
供稿:網友
Java代碼
復制代碼 代碼如下:

<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>

復制代碼 代碼如下:

<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來調bug
引用
復制代碼 代碼如下:

<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中可以添加一個方法
引用
復制代碼 代碼如下:

function Console(){
this.log=function(inText){
alert(inText);
}
}
var console=new Console();
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云梦县| 奉化市| 汝城县| 茂名市| 富裕县| 饶阳县| 崇义县| 大同市| 温宿县| 娱乐| 南丹县| 射阳县| 沅陵县| 图木舒克市| 洛川县| 射阳县| 浑源县| 手游| 新邵县| 额济纳旗| 昌平区| 平阴县| 平安县| 阿坝| 茂名市| 双流县| 无棣县| 桐城市| 都江堰市| 汽车| 洪雅县| 昆明市| 安岳县| 博爱县| 奎屯市| 肃宁县| 星子县| 扬州市| 关岭| 兰州市| 桂东县|