最新清华大学出版社郭克华JavaWeb程序设计上机习题答案Word格式.docx
《最新清华大学出版社郭克华JavaWeb程序设计上机习题答案Word格式.docx》由会员分享,可在线阅读,更多相关《最新清华大学出版社郭克华JavaWeb程序设计上机习题答案Word格式.docx(61页珍藏版)》请在冰豆网上搜索。
password"
nbsp<
submit"
value="
OK"
button"
ForgetPassword"
/form>
Main、
(SectionC)
Regiter、
NewMember<
ID&
Password&
Re-Password&
FirstName&
LastName&
Address&
City&
State&
nbsp
select>
optionselected>
[SelectState]<
/option>
/select>
Country&
EmailAddress&
SelectInterest
checkbox"
Technology
Enterprise
Research
Government
People
LifeStyle
Opinion<
Question&
[SelectQuestion]<
Answer&
textarea"
SubmitInformation"
reset"
ResetForm"
Top、
login.html"
Login<
register.html"
Register<
Treemenu、
作者的个人简介、
作者:
局局局
Chapter3
1、
scripttype="
text/javascript"
functionfun(){
a=form.text1.value;
b=a/50;
c=a%50/20;
d=a%50%20/10;
e=a%50%20%10/5;
f=a%50%20%10%5;
document.form.text2.value=Math.floor(b);
document.form.text3.value=Math.floor(c);
document.form.text4.value=Math.floor(d);
document.form.text5.value=Math.floor(e);
document.form.text6.value=f;
}
/script>
formname="
form"
您输入的金额为:
inputname="
text1"
type="
onclick="
fun()"
确定"
找零的数量为:
nbsp50元<
text2"
张<
nbsp20元<
text3"
nbsp10元<
text4"
nbsp5元<
text5"
nbsp1元<
text6"
2、
functionadd(){
n1=Number(document.form.text1.value);
n2=Number(document.form.text2.value);
n3=Number(document.form.text3.value);
n4=Number(document.form.text4.value);
n5=Number(document.form.text5.value);
document.form.text6.value=n1+n2+n3+n4+n5;
book1:
book2:
book3:
book4:
book5:
add()"
求和"
总价:
2S(循环)、
varn=newArray();
for(i=1;
i<
6;
i++){
document.writeln("
book"
+i+"
inputname=texttype=text>
"
);
for(i=0;
5;
n[i]=Number(document.getElementsByName("
)[i].value);
document.form.text.value=n[0]+n[1]+n[2]+n[3]+n[4];
3、
=100;
欢迎&
nbsp"
4、
varmax=0;
varmin=0;
n[1]=Number(document.form.text1.value);
n[2]=Number(document.form.text2.value);
n[3]=Number(document.form.text3.value);
n[4]=Number(document.form.text4.value);
n[5]=Number(document.form.text5.value);
n[6]=Number(document.form.text6.value);
n[7]=Number(document.form.text7.value);
n[8]=Number(document.form.text8.value);
n[9]=Number(document.form.text9.value);
n[10]=Number(document.form.text10.value);
=10;
if(n[i]>
max){
max=n[i];
min=n[1];
for(j=1;
j<
j++){
if(n[j]<
min){
max=n[j];
document.form.text13.value=(n[1]+n[2]+n[3]+n[4]+n[5]+n[6]+n[7]+n[8]+n[9]+n[10])/10;
document.form.text11.value=max;
document.form.text12.value=min;
book&
nbsp1:
nbsp2:
nbsp3:
nbsp4:
nbsp5:
nbsp6:
nbsp7:
text7"
nbsp8:
text8"
nbsp9:
text9"
book10&
nbsp:
text10"
最高价格:
text11"
最低价格:
text12"
平均价格:
text13"
4S(循环)、
varave=0;
11;
10;
min=n[0];
for(j=0;
min=n[j];
for(k=0;
k<
k++){
sum+=n[k];
document.form.text1.value=max;
document.form.text2.value=min;
document.form.text3.value=ave;
Chapter4
4-1、
(1)<
%@pagelanguage="
java"
import="
java.util.*"
pageEncoding="
gb2312"
%>
<
for(vari=1;
i++)
document.writeIn("
欢迎(JS)<
%
for(inti=1;
out.print("
欢迎(JSP)<
}
%>
(2)<
contentType="
text/html;
charset=gb2312"
errorPage="
l6.jsp"
for(inti=0;
100;
out.println("
欢迎<
<
(3)<
for(i=0;
i++){document.write("
4-2
%@pagelanguage="
charset=gb2312"
money"
type="
找零"
%!
int[]monReturn=newint[5];
int[]monElements=newint[]{50,20,10,5,1};
voidmoneyDeal(intmon){
monReturn[i]=(int)Math.floor(mon/monElements[i]);
mon=mon%monElements[i];
%Strings=request.getParameter("
if(s!
=null){
intmon=Integer.parseInt(s);
moneyDeal(mon);
for(inti=0;
应找零为:
%=monElements[i]%>
元<
%=monReturn[i]%>
Stringstr;
functiongetMoney(){
varinputMon=document.form.money.value;
str=inputMon;
document.form.submit();
action="
?
money="
+<
%=str%>
onclick=getMoney()value="