📄 petdetail1.jsp
字号:
<%@ taglib prefix="bean" uri="/WEB-INF/struts-bean.tld"%><%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld"%><%@ taglib prefix="html" uri="/WEB-INF/struts-html.tld"%><%@ page language="java" pageEncoding="GB18030"%><%@ include file="inc.jsp"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>我是 ${petinfo.petName} 宝贝!</title> <script type='text/javascript' src='dwr/interface/IPetBusiness.js'></script> <script type='text/javascript' src='dwr/engine.js'></script> <script type='text/javascript' src='dwr/util.js'></script> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <link rel="stylesheet" type="text/css" href="styles.css"> <script> var pet = null; function doFeed(petId) { feed(); var btn = document.getElementById("feedBtn"); btn.disabled = true; if (!pet) { IPetBusiness.getPetinfo(petId,feedcallback); } else { pet.petStrength = pet.petStrength+30; IPetBusiness.updateTraining(petId,"TRANING_TYPE_FEED"); } setTimeout("btnAnable('feed')",60000); } function doStory(petId) { story(); var btn = document.getElementById("storyBtn"); btn.disabled = true; if (!pet) { IPetBusiness.getPetinfo(petId,storycallback); } else { pet.petCute = pet.petCute+1; pet.petLove = pet.petLove+3; pet.petStrength = pet.petStrength-5; IPetBusiness.updateTraining(petId,"TRANING_TYPE_STORY"); } setTimeout("btnAnable('story')",60000); } function doGame(petId) { game(); var btn = document.getElementById("gameBtn"); btn.disabled = true; if (!pet) { IPetBusiness.getPetinfo(petId,gamecallback); } else { pet.petCute = pet.petCute+3; pet.petLove = pet.petLove+1; pet.petStrength = pet.petStrength-5; IPetBusiness.updateTraining(petId,"TRANING_TYPE_GAME"); } setTimeout("btnAnable('game')",60000); } function btnAnable(p,s) { var btn = document.getElementById(p + "Btn"); if (btn.disabled) btn.disabled = false; setImg(p); clearTimeout(); DWRUtil.setValue("spanStrength",pet.petStrength); DWRUtil.setValue("spanCute",pet.petCute); DWRUtil.setValue("spanLove",pet.petLove); } function feedcallback(msg) { pet = msg; pet.petStrength = pet.petStrength+30; IPetBusiness.updateTraining(pet.petId,"TRANING_TYPE_FEED"); } function storycallback(msg) { pet = msg; pet.petCute = pet.petCute+1; pet.petLove = pet.petLove+3; pet.petStrength = pet.petStrength-5; IPetBusiness.updateTraining(pet.petId,"TRANING_TYPE_STORY"); } function gamecallback(msg) { pet = msg; pet.petCute = pet.petCute+3; pet.petLove = pet.petLove+1; pet.petStrength = pet.petStrength-5; IPetBusiness.updateTraining(pet.petId,"TRANING_TYPE_GAME"); } //////////////////////////////////////////////////////////// function doTraining(tType) { document.forms[0].elements["operate"].value = "savePet"; document.forms[0].elements["trainingType"].value = tType; document.forms[0].submit(); } function feed() { setImg("feed"); var oDoingDiv = document.getElementById("doingDiv"); oDoingDiv.innerHTML ="${petinfo.petName}吃饭ing"; //setTimeout("doTraining('TRANING_TYPE_FEED')",2000); } function story() { setImg("story"); var oDoingDiv = document.getElementById("doingDiv"); oDoingDiv.innerHTML ="${petinfo.petName}在听故事"; //setTimeout("doTraining('TRANING_TYPE_STORY')",2000); } function game() { setImg("game"); var oDoingDiv = document.getElementById("doingDiv"); oDoingDiv.innerHTML ="${petinfo.petName}在玩耍"; //setTimeout("doTraining('TRANING_TYPE_GAME')",2000); } function setImg(p) { var oDoingImg = document.getElementById("doingImg"); var src = oDoingImg.src; if (src.indexOf("_")==-1) { src = src.replace(".jpg","_"+p+".jpg"); } else { src = src.replace("_"+p+".jpg",".jpg"); var oDoingDiv = document.getElementById("doingDiv"); oDoingDiv.innerHTML =""; } oDoingImg.src = src; } </script> </head> <body> <form name="petForm" method="post" action="petinfo.do"> <input type="hidden" name="operate" value="savePet"> <input type="hidden" name="trainingType" value=""> <input type="hidden" name="pet_id" value="${petinfo.petId}"> <div class="main_div"> <h1> 我的宝贝儿 </h1> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="450"> </td> <td rowspan="2" style="background-color:pink;text-align:right;"> 欢迎您, ${petinfo.petOwnerName} ! <a href="petinfo.do?operate=logout">注销</a> </td> </tr> <tr> <td style="background-color:pink;"> <a href="index.jsp">首页</a> | 我是 <a href="petinfo.do?operate=petDetail&id=${petinfo.petId}">${petinfo.petName}</a> 宝贝! </td> </tr> </table> </div> <div class="main_div"> <table> <tr> <td width="300px" valign="top"> <table> <tr> <td valign="top"> 宠物ID: <b>${petinfo.petId}</b> <a href="petinfo.do?operate=petDetail&edit=1">编辑</a> <br /> ----------------------------------------- <br /> 我叫 ${petinfo.petName}, 是一只伟大的${petinfo.petSex}${typeMap[petinfo.petType]}。 <br /> 我的主人是 <a href="mailto:${petinfo.petOwnerEmail}">${petinfo.petOwnerName}</a>。 <br /> ----------------------------------------- <br /> 力量:<span id="spanStrength">${petinfo.petStrength}</span> <br /> 能力:<span id="spanCute">${petinfo.petCute}</span> <br /> 爱心:<span id="spanLove">${petinfo.petLove}</span> <br /> ----------------------------------------- </td> </tr> </table> <div id="doingDiv"></div> <img id="doingImg" src="${petinfo.petPic}" /> <div id="trainingDiv"> <button id="feedBtn" onclick="javascript:doFeed(${petinfo.petId});"> 喂食 </button> <button id="storyBtn" onclick="javascript:doStory(${petinfo.petId});"> 讲故事 </button> <button id="gameBtn" onclick="javascript:doGame(${petinfo.petId});"> 游戏 </button> </div> <div id="diaryDiv"> <a href="editPetDiary.jsp">写宠物日记</a> </div> ------------------------------ <br /> ${petinfo.petIntro} <br /> <div id="funnyDiv"></div> </td> <td width="500px" valign="top"> <div id="diaryDiv"> <% Date d = new Date(); String DateStr = d.getYear() + 1900 + "-"; DateStr += d.getMonth() + 1 + "-"; %> <%=d.getYear() + 1900%> 年 <%=d.getMonth() + 1%> 月 <table class='cal'> <tr> <% for (int i = 1; i <= 31; i++) { String DateStr2 = DateStr; DateStr2 += i < 10 ? "0" + i : i + ""; %> <td valign='top'> <%=i%> <logic:present name="<%=DateStr2%>"> <logic:iterate id="diary" name="<%=DateStr2%>"> <bean:define id="id" name="diary" property="diaryId" /> <a href="petDiary.do?operate=toDetail&id=<%=id%>"> <li> <bean:write name="diary" property="diaryTitle" /> </li> <br /> </a> </logic:iterate> </logic:present> </td> <% if (i % 7 == 0) out.println("</tr><tr>"); %> <% } %> </tr> </table> </div> </td> </tr> </table> </div> <hr size="1" width="800px" color="black" /> <div class="main_div" style="border-width:0;text-align:right;"> copyright © 2007 北京阿博泰克北大青鸟信息技术有限公司 </div> </form> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -