<%@ page language="java" contenttype="text/html; charset=utf-8"
pageencoding="utf-8"%>
<%
string path= request.getcontextpath();
string basepath=request.getscheme()+"://"+request.getservername()+":"+request.getserverport()+path+"/";
%>
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<base href="<%=basepath%>"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>函数</title>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function(){
//计算阶乘,方式一
function factorial(n){
var i=1;
while(n>1){
i*=n;
n--;
}
return i;
}
console.log("方式一计算出的结果是:"+factorial(5));
//计算阶乘,方式二
function factorial1(n){
var i,t=1;
for(i=2;i<=n;i++)
t*=i;
return t;
}
console.log("方式二计算出的结果是:"+factorial1(5));
function moveon(){
var answer=confirm("are you ready?");
if(answer){
//进行页面的跳转,方式一
//window.location="http://wwww.baidu.com";
//进行页面的跳转,方式二
window.open("http://wwww.baidu.com","新的窗口", 'height=400,width=400,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
}
//写法一
//settimeout("moveon()",60000);
//写法二
settimeout(moveon,60000);
}
moveon();
});
</script>
</head>
<body>
</body>
</html>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号