?? 25-2.html
字號:
<html>
<head>
<title></title>
<script>
function throw_exception(message)
{
var exception = new Error(message);
throw exception;
}
function sinAB(a,b)
{
try
{
if(typeof(a) != "number")
throw_exception("第一個參數不是有效的數值!");
if(typeof(b) != "number")
throw_exception("第二個參數不是有效的數值!");
var res = Math.sin(a)*Math.cos(b) + Math.cos(a) * Math.sin(b);
return res;
}
catch(ex)
{
alert("調用sinAB()函數出現異常 => " + ex.message);
}
}
//調用sinAB()
var a = sinAB(3,'a');
</script>
</head>
<body>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -