清華大學(xué)出版社郭克華JavaWeb程序設(shè)計上機習(xí)題答案_第1頁
清華大學(xué)出版社郭克華JavaWeb程序設(shè)計上機習(xí)題答案_第2頁
清華大學(xué)出版社郭克華JavaWeb程序設(shè)計上機習(xí)題答案_第3頁
清華大學(xué)出版社郭克華JavaWeb程序設(shè)計上機習(xí)題答案_第4頁
清華大學(xué)出版社郭克華JavaWeb程序設(shè)計上機習(xí)題答案_第5頁
已閱讀5頁,還剩31頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、Chapter2Frame、<html><body><a href=" 作者的個人簡介.html"target="main"> 作者的個人簡介</a></body></html>Login 、<html><body><p align="center">Please Log In</p><br><form>&nbsp&nbsp&nbspLogin:<input ty

2、pe="text"><br>Password:<input type="password"><br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="submit" value="OK"><input type="button" value="ForgetPassword">

3、</form></body></html>Main 、<html><body>(Section C)</body></html>Regiter 、<html><body><p align="center">New Member</p><br><form>ID&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&a

4、mp;nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"><br>Password&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="password"><br>Re-Password&nbsp&nbsp&nbsp&nbsp&nbsp<input type="passwo

5、rd"><br>First Name&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"><br>Last Name&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"><br>Address&nbsp&nbsp&nbsp&nbsp&nbsp

6、&nbsp&nbsp&nbsp&nbsp<input type="text"><br>City&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"><br> State&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&a

7、mp;nbsp&nbsp&nbsp&nbsp<select><option selected>Select State</option></select><br>Country&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text"><br> Email Address&nbsp&nbsp&nbsp<

8、;input type="text"><br>Select Interest<input type="checkbox">Technology<input type="checkbox">Enterprise<input type="checkbox">Research<input type="checkbox">Government<input type="checkbox">People<

9、input type="checkbox">Life Style<input type="checkbox">Opinion<br>Question&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<select><option selected>Select Question</option></select><br>Answer&nbsp&nbsp&nbsp&am

10、p;nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="textarea"><br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="submit" value="

11、Submit Information"<input type="reset" value="Reset Form"></form></body></html>Top、<html><body><a href="login.html"target="main">Login</a><br><a href="register.html"target="main"

12、>Register</a></body></html>Treemenu、<html><body><a href="作者的個人簡介.html"target="main">作者的個人簡介 </a></body></html>作者的個人簡介、<html><body>作者:局局局</body></html>Chapters1、 <html><body>元<input元<

13、;input元<input元<input元<inputvalue=" 求 和<script type="text/javascript"> function fun()b=a/50;c=a%50/20;d=a%50%20/10;e=a%50%20%10/5;f=a%50%20%10%5;</script> <form name="form">您輸入的金額為:&nbsp<input name="text1" type="text">&

14、lt;br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<i nput type="button" onclick="fun()" value="確定 "><br>找零的數(shù)量為:<br> &nbsp&nbsp&n

15、bsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp50 name="text2" type="text"> 張 <br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp20 name="text3"

16、type="text">張 <br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp10name="text4" type="text">張 <br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&am

17、p;nbsp&nbsp&nbsp&nbsp&nbsp5 name="text5" type="text">張 <br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp1 name="text6" type="text">張 <br></for

18、m></body></html>2、<html><body><script type="text/javascript">function add()</script><form name="form">book1:&nbsp<input name="text1" type="text"><br>book2:&nbsp<input name="text2" ty

19、pe="text"><br>book3:&nbsp<input name="text3" type="text"><br>book4:&nbsp<input name="text4" type="text"><br>book5:&nbsp<input name="text5" type="text"><br>&nbsp&nbsp

20、&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" onclick="add()""><br> 總價 :&nbsp&nbsp<input name="text6" type="text"><br> </form> </body></html>2S (循環(huán))、<html><body><script t

21、ype="text/javascript">var n=new Array();for(i=1;i<6;i+)document.writeln("book"+i+"&nbsp&nbsp<input name=text type=text><br>");function add()for(i=0;i<5;i+)ni=Number(document.getElementsByName("text")i.value); </script> <fo

22、rm name="form">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" onclick="add()" value="求和 "><br>總價:&nbsp&nbsp<input name="text" type="text"><br></form></body>

23、</html>3、<html><body><script type="text/javascript">for(i=1;i<=100;i+)document.writeln(" 歡迎 &nbsp"); </script></body></html>4、<html><body><script type="text/javascript">var n=new Array();var max=0;var mi

24、n=0;function fun()for(i=1;i<=10;i+)if(ni>max)max=ni; min=n1;for(j=1;j<=10;j+)if(nj<min)max=nj;)</script><form name="form">book&nbsp1:&nbsp&nbsp&nbsp<input name="text1" type="text"><br>book&nbsp2:&nbsp&nbsp&

25、amp;nbsp<input name="text2" type="text"><br>book&nbsp3:&nbsp&nbsp&nbsp<input name="text3" type="text"><br>book&nbsp4:&nbsp&nbsp&nbsp<input name="text4" type="text"><br>book

26、&nbsp5:&nbsp&nbsp&nbsp<input name="text5" type="text"><br>book&nbsp6:&nbsp&nbsp&nbsp<input name="text6" type="text"><br>book&nbsp7:&nbsp&nbsp&nbsp<input name="text7" type=&quo

27、t;text"><br>book&nbsp8:&nbsp&nbsp&nbsp<input name="text8" type="text"><br>book&nbsp9:&nbsp&nbsp&nbsp<input name="text9" type="text"><br>book10&nbsp:&nbsp&nbsp<input name="

28、;text10" type="text"><br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" onclick="fun() value="確定"><br>最高價格:<input name="text11" type="text"><br>最低價格:<

29、;input name="text12" type="text"><br>平均價格:<input name="text13" type="text"><br></form></body></html>4S (循環(huán))、<html><body><script type="text/javascript">var n=new Array();var min=0;var ave=0;var

30、max=0;for(i=1;i<11;i+)document.writeln("book"+i+"&nbsp&nbsp&nbsp<input name=text type=text><br>");function add()for(i=0;i<10;i+)ni=Number(document.getElementsByName("text")i.value);for(i=0;i<10;i+)if(ni>max)max=ni;min=n0;for(j=0;j<

31、10;j+)if(nj<min)min=nj;)for(k=0;k<10;k+)sum+=nk;</script><form name="form">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="button" onclick="add() value="確定"><br>最高價格:<input name="te

32、xt1" type="text"><br>最低價格:<input name="text2" type="text"><br>平均價格:<input name="text3" type="text"><br></form></body></html>Chapter44-1、(1)<% page language="java" import="java.

33、util.*" pageEncoding="gb2312"%><html><body><script type="text/javascript">for(var i=1;i<=100;i+)document.wr讓eIn("歡迎(JS)<br>");</script><%for(int i=1;i<=100;i+)out.print(" 歡迎(JSP)<br>"); %></body><

34、;/html>(2)<% page language="java" contentType="text/html; charset=gb2312" errorPage="l6.jsp"%><html><body><%for(int i=0;i<100;i+) out.println(" 歡迎 <br>");%><br></body></html>(3)<% page language="jav

35、a" import="java.util.*" pageEncoding="gb2312"%><html><body><script type="text/javascript">for(i=0;i<100;i+)document.write("歡迎 <br>");</script></body></html>4-2(1)<%page language="java" contentTy

36、pe="text/html;charset=gb2312" errorPage="l6.jsp"%><html><body><form name="form">您輸入的金額為:<input name="money"type="text"><br><input type="submit" value=" 找零 "><br><%!intmonReturn=new i

37、nt5;intmonElements=new int50,20,10,5,1;void moneyDeal(int mon)for(int i=0;i<5;i+)monReturni=(int)Math.floor(mon/monElementsi);mon=mon%monElementsi;%><%String s=request.getParameter("money");if(s!=null)int mon=Integer.parseInt(s);moneyDeal(mon);for(int i=0;i<5;i+)%>應(yīng)找零為:<%

38、=monElementsi%> 元 <%=monReturni%> 張 <br><%></form></body></html>(2)<%page language="java" contentType="text/html;charset=gb2312" errorPage="l6.jsp"%><html><body><%!String str;intmonReturn=new int5;intmonElement

39、s=new int50,20,10,5,1;void moneyDeal(int mon)for(int i=0;i<5;i+)monReturni=(int)Math.floor(mon/monElementsi);mon=mon%monElementsi;%><script type="text/javascript">function getMoney()str=inputMon;</script><form name="form" action="?money="+<%=str%

40、>>您輸入的金額為:<input name="money"type="text"><br><input type="button" onclick=getMoney() value="找零 "><br> <%String s=request.getParameter("money");if(s!=null)int mon=Integer.parseInt(s);moneyDeal(mon);for(int i=0;i<5;i

41、+)%>應(yīng)找零為:<%=monElementsi%> 元 <%=monReturni%> 張 <br><%></form></body></html>(3)<%page language="java" contentType="text/html;charset=gb2312" errorPage="l6.jsp"%><html><body><%!intmonReturn=new int5;intmonE

42、lements=new int50,20,10,5,1;void moneyDeal(int mon)for(int i=0;i<5;i+)monReturni=(int)Math.floor(mon/monElementsi);mon=mon%monElementsi;%><script type="text/javascript">function getMoney()location.href="?money="+inputMon;</script><form name="form"&g

43、t;您輸入的金額為:<input name="money"type="text"><br><input type="button" onclick=getMoney() value="找零 "><br><%String s=request.getParameter("money");if(s!=null)int mon=Integer.parseInt(s);moneyDeal(mon);for(int i=0;i<5;i+)%>

44、應(yīng)找零為:<%=monElementsi%> 元 <%=monReturni%> 張 <br><%></form></body></html>(4)<%page language="java" contentType="text/html;charset=gb2312" errorPage="l6.jsp"%><html><body><%!String str;intmonReturn=new int5;int

45、monElements=new int50,20,10,5,1;void moneyDeal(int mon)for(int i=0;i<5;i+)monReturni=(int)Math.floor(mon/monElementsi);mon=mon%monElementsi;%><script type="text/javascript">function getMoney()</script><form name="form">您輸入的金額為:<input name="money&qu

46、ot;type="text"><br><input type="button" onclick=getMoney() value="找零 "><br><%String s=request.getParameter("money");if(s!=null)int mon=Integer.parseInt(s);moneyDeal(mon);for(int i=0;i<5;i+)%>應(yīng)找零為:<%=monElementsi%> 元<%=mon

47、Returni%> 張 <br><%>4-3、<% page language="java" contentType="text/html; charset=gb2312" errorPage="l6.jsp"%><html><body><%/String str="歡迎";for(int i=0;i<100;i+)%>歡迎<br><%><br></body></html>

48、4-4、<% page language="java" contentType="text/html; charset=gb2312" errorPage="l6.jsp"%><html><body><%for(int i=1;i<10;i+)%><a href="4.jsp?n=<%=i%>"><%=i%></a><br><%><br></body></htm

49、l>4-5、<% page language="java" contentType="text/html; charset=gb2312" errorPage="l6.jsp"%><html><body><%for(int i=1;i<10;i+)%><%="<a href=?n="+i+">"+i+"</a><br>"%><%><%String st

50、r=request.getParameter("n");if(str!=null)int n=Integer.parseInt(str);%>該數(shù)字的平方為:<%=n*n%><HR><%><br></body></html>4-6 、<% page contentType="text/html; charset=gb2312" isErrorPage="true"%><html><body><%out.println

51、(" 網(wǎng)頁出現(xiàn)異常!");%></body></html>Chapter55-1 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body>登錄:<form name="loginForm" method="post">賬號:<input name="account" t

52、ype="text"><br>密碼:<input name="password" type="password"><br><input type="button" value="登陸 " onClick="validate()"></form><script type="text/javascript">function validate()alert(" 登陸成功!&

53、quot;);return;else alert(" 登陸失?。?quot;);return;loginForm.submit();</script></body></html>5-2 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body> 登錄:<form name="loginForm" method="po

54、st">賬號:<input name="account" type="text"><br>密碼:<input name="password" type="password"><br>是否注冊為會員:<input name="member1" value="yes" type="checkbox"> 是 <br><input type="button&qu

55、ot; value="登陸 " onClick="validate()"></form><script type="text/javascript">function validate()alert(" 登陸成功, 歡迎您注冊為會員!");return;else alert(" 登陸成功!");return;else alert(" 登陸失?。?quot;);return;loginForm.submit();</script></bod

56、y></html>5-3 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><%-<%String str="N"int number=Integer.parseInt(str);%>-%><form action="5-3-1.jsp"><input type="text&quo

57、t; name="number"><input type="submit" value=" 提交 "></form></body></html>5-3-1 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><% String str=request.getParamete

58、r("number");int number=Integer.parseInt(str);%><%for(int i=1;i<=number;i+)out.print("歡迎 <br>");%></body></html>5-4 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><%!

59、intmonReturn=new int5;intmonElements=new int50,20,10,5,1;void moneyDeal(int mon)for(int i=0;i<5;i+)monReturni=(int)Math.floor(mon/monElementsi);mon=mon%monElementsi;%><form name="form1" >應(yīng)付款 <input name="money1"type="text"><br>實際付款<input name=

60、"money2"type="text"><br><input type="submit" value=" 提交 "><br></form><%String m1=request.getParameter("money1");String m2=request.getParameter("money2");if(m1!=null&&m2!=null)int m11=Integer.parseInt(m1

61、);int m22=Integer.parseInt(m2);int mon=m22-m11;moneyDeal(mon);%>應(yīng)找零 <%=mon %>, <br><% for(int i=0;i<5;i+)%><%=monElementsi%> 元 <%=monReturni%> 張 ,<%></body></html>5-5 、<% page language="java" import="java.util.*" pageEncodi

62、ng="gb2312"%><html><body>登錄:<form name="loginForm" action="5-5-2.jsp" method="post">賬號:<input name="account" type="text"><br>密碼:<input name="password" type="password"><br><

63、input type="button" value="登陸 " onClick="validate()"></form><script type="text/javascript"> function validate()alert(" 登陸失敗!");return;loginForm.submit();</script></body></html>5-5-2 、<% page language="java&quo

64、t; import="java.util.*" pageEncoding="gb2312"%><html><body><%String str=request.getParameter("account"); %><form action="5-5-3.jsp" method="post">用戶姓名:<input name="name" type="text"><br><i

65、nput type="submit" value="提交" ><input name="account1" type="hidden" value="<%=str%>"></form></body></html>5-5-3 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%>

66、<html><body><%String str1=request.getParameter("account1");String str2=request.getParameter("name");out.println(" 用戶賬號:"+str1+"<br>"+" 用戶姓名:"+str2);%></body></html>Chapter66-1 、<% page language="java"

67、import="java.sql.*" pageEncoding="gb2312"%><html><body><%Connection conn=DriverManager.getConnection("jdbc:odbc:DSSchool");Statement stat=conn.createStatement();String sql="SELECT*"ResultSet rs=stat.executeQuery(sql);while(rs.next()String stu

68、no=rs.getString("STUNO");String stuname=rs.getString("STUNAME");String stusex=rs.getString("STUSEX");out.print(stuno+""+stuname+""+stusex+"<br>");stat.close();conn.close();%></body></html>6-2 、<% page language="

69、java" import="java.util.*" pageEncoding="gb2312"%><html><body><form action="6-2-1" method="post">輸入姓名:<input type="text" name="stuname"><br><br><input type="submit" value=" 提交 &q

70、uot;></form></body></html>6-2-1 、<% page language="java" import="java.sql.*" pageEncoding="gb2312"%><html><body><%request.setCharacterEncoding("gb2312");String name=request.getParameter("stuname");Connection

71、conn=DriverManager.getConnection("jdbc:odbc:DSSchool");Statement stat=conn.createStatement();String sql="SELECT STUNO,STUNAME,STUSEX FORM T_STUDENT WHERE STUNO='"+name+"'"ResultSet rs=stat.executeQuery(sql);while(rs.next()String stuno=rs.getString("STUNO&qu

72、ot;);String stuname=rs.getString("STUNAME");String stusex=rs.getString("STUSEX");out.print(stuno+""+stuname+""+stusex+"<br>");stat.close();conn.close();%></body></html>6-3 、<% page language="java" import="java.u

73、til.*" pageEncoding="gb2312"%><html><body><form action="6-3-1.jsp" method="post">輸入學(xué)號:<input type="text" name="sno">輸入姓名:<input type="text" name="name"><input type="submit" value=

74、" 提交 "></form></body></html>6-3-1 、<% page language="java" import="java.sql.*" pageEncoding="gb2312"%><html><body><% request.setCharacterEncoding("gb2312");String sno=request.getParameter("sno");Str

75、ing name=request.getParameter("name");Connection conn=DriverManager.getConnection("jdbc:odbc:DSSchool");Statement stat=conn.createStatement();String sql="SELECT STUNO,STUNAME FORM T_STUDENT WHERE STUNO='"+name+"'"ResultSet rs=stat.executeQuery(sql);if(

76、!rs.next()out.println(" 學(xué)號不存在,登錄失??!");elseString stuname=rs.getString("STUNAME");if(stuname.equals(name)out.print(" 恭喜,登陸成功!");elseout.println("姓名不存在!");stat.close();conn.close();%></body></html>Chapter77-1 、<% page language="java"

77、import="java.util.*" pageEncoding="gb2312"%><html><body><%String address=request.getRemoteAddr();int index=address.indexOf('.');String addressCut=address.substring(0,index);if(addressCut.equals("192")out.print(" 抱歉,你被禁止訪問!");%><

78、/body></html>7-2 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><form action="7-2-1.jsp" method="post">輸入圖書價格:<input type="text" name="price"></input>&

79、lt;br><input type="submit" value="提交"></input></form></body></html>7-2-1 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><%String str=request.getParameter("pr

80、ice");%><form action="7-2-2.jsp" method="post">輸入?匚率:<input type="text" name="forecast"></input><br><input type="hidden" name="price" value="<%=str%>"></input><input type="

81、submit" value="提交"></input></form></body></html>7-2-2 、<% page language="java" import="java.util.*" pageEncoding="gb2312"%><html><body><%String str1=request.getParameter("price");String str2=request.getParameter("forecast");double d1=Double.parseDouble(str1);double d2=Double.parseDouble(str2);double r=d1/d2;out.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論