<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0//EN""http://www.w3.org/TR/REC-html140/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>全局函数和局部函数</title>
<script language="javascript" type="text/javascript">
<!--
var msg = "/n局部函数调用实例:/n/n";
//响应按钮的onclick事件处理程序
function multi(m, n){
var result;
function inner(m){
if(m % 2 != 0){
return 0;
}
else{
return 1;
}
}
result = inner(m) * n;
msg += "输入参数:/n";
msg += "m=" + m + "/nn=" + n + "/n";
msg += "乘积结果:/n";
msg += "result=" + result + "/n";
alert(msg);
}
-->
</script>
</head>
<body>
<center>
<form>
<input type="button" value="局部函数调用实例测试" οnclick="multi(4,3)">
</form>
</center>
</body>
</html>
局部函数调用实例
最新推荐文章于 2023-06-27 21:31:10 发布