<head>
</head>
<body>
<input type="text" id="text1" onfocus="this.select()" /><input type="button" value="连接" onclick="GetNum('text1')" />
<script type="text/javascript">
function GetNum(textid) {
var text1 = document.getElementById(textid).value
var num = 1
if (text1 == "") {
document.getElementById(textid).value = "0"
num = 0
}
else {
for (var i = 1i <Number(text1) + 1i++) {
num *= i
}
}
document.getElementById(textid).value += "!=" + num
}
</script>
</body>
</html>
jsp是在html中嵌入Java小片段的技术<html>
<head>
</head>
<body>
<form action="这里写你要提交的页面路径" method="post" >
请输入你要求几的阶乘<input type = ”textbox“ name ="fac "></input>
<input type="submit" name = "submit " value ="确定"></input>
</form>
<%
int getvalue = response.getParemeter("fac")
int sum=0,fac=1
for(int i=1i<=getvaluei++)
{
fac=fac*i
sum+=fac
}
%>
你要求的结果为<%=fac%>
</body>
</html>