在javascript中允许使用嵌套函数:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>嵌套函数 - Liehuo.net</title>
<script type="text/javascript">
function fun1(){
function fun2(){
var a=50;
var b=a+5;
return a+b;
}
var a=900;
var b=Math.sqrt(a);
return b+fun2();
}
</script>
</head>
<body>
<div id="main">
<script type="text/javascript">
document.write("函数的返回值为:"+fun1());
</script>
</div>
</body>
</html>