📄 adopt.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>领养宝贝</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>
function checkName(name)
{
IPetBusiness.getCheckName(name,callback);
}
function callback(msg){
if (msg) {
alert("宠物名重复");
} else {
alert("宠物名可以注册");
}
}
var validateMsg = "";
function checkNotEmpty(ctlName,label)
{
var oCtl = document.forms[0].elements[ctlName];
if (oCtl.value=="")
{
if (label)
{
validateMsg += label;
}
validateMsg += "不能为空!\n";
oCtl.focus();
}
}
function checkValidateMsg()
{
if (validateMsg!="")
{
alert(validateMsg);
return false;
}
return true;
}
function doAdopt()
{
validateMsg = "";
checkNotEmpty("pet_password","密码");
checkNotEmpty("pet_owner_name","宠物主人");
checkNotEmpty("pet_type","类");
checkNotEmpty("pet_name","宠物名");
if ( !checkValidateMsg() )
{
return;
}
document.forms[0].elements["operate"].value = "savePet";
document.forms[0].submit();
}
function setPetType(oSelect)
{
var typeValue = oSelect.options[oSelect.selectedIndex].value;
var oStrength = document.forms[0].elements["pet_strength"];
var oCute = document.forms[0].elements["pet_cute"];
var oLove = document.forms[0].elements["pet_love"];
var oPic = document.forms[0].elements["pet_pic"];
var oImg = document.getElementById("petImg");
oPic.value = "images/";
if (typeValue==1)//Pit
{
oStrength.value = 60;
oCute.value = 60;
oLove.value = 60;
oPic.value += "pig.jpg";
}
else if (typeValue==2)//Cat
{
oStrength.value = 40;
oCute.value = 60;
oLove.value = 80;
oPic.value += "cat.jpg";
}
else if (typeValue==3)//Dragon
{
oStrength.value = 80;
oCute.value = 60;
oLove.value = 40;
oPic.value += "dragon.jpg";
}
else{
oStrength.value = 0;
oCute.value = 0;
oLove.value = 0;
oPic.value += "unkown.jpg";
}
oImg.src = oPic.value;
}
</script>
</head>
<body>
<html:form method="post" action="/petinfo">
<input type="hidden" name="operate" value="savePet">
<html:hidden property="pet_pic" />
<html:hidden property="pet_id" />
<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;">
<a href="index.jsp">登录</a>
</td>
</tr>
<tr>
<td style="background-color:pink;">
<a href="index.jsp">首页</a>
|
领养宠物
</td>
</tr>
</table>
</div>
<div class="main_div">
<table>
<tr>
<td width="320px" valign="top">
<table class="input_table" width="100%">
<tr><th>宠物名:</th><td><html:text property="pet_name" onblur="checkName(this.value)"/></td></tr>
<tr><th>类:</th><td>
<html:select property="pet_type" onchange="javascript:setPetType(this);">
<html:option value="">请选择...</html:option>
<logic:iterate id="type" collection="<%=typeMap %>">
<option value="<bean:write name="type" property="key"/>">
<bean:write name="type" property="value"/>
</option>
</logic:iterate>
</html:select>
</td></tr>
<tr><th>性别:</th><td>
<html:radio property="pet_sex" value="男"/>男
<html:radio property="pet_sex" value="女"/>女
<html:radio property="pet_sex" value="小"/>小
</td></tr>
<tr><th>力量:</th><td><html:text property="pet_strength" readonly="true"/></td></tr>
<tr><th>能力:</th><td><html:text property="pet_cute" readonly="true"/></td></tr>
<tr><th>爱心:</th><td><html:text property="pet_love" readonly="true"/></td></tr>
<tr><th>介绍:</th><td><html:textarea property="pet_intro"/></td></tr>
<tr><th>主人名:</th><td><html:text property="pet_owner_name"/></td></tr>
<tr><th>主人EMail:</th><td><html:text property="pet_owner_email"/></td></tr>
<tr><th>密码:</th><td><html:text property="pet_password"/></td></tr>
<tr><th> </th><td><button onclick="javascript:doAdopt();">领养</button></td></tr>
</table>
</td>
<td valign="top">
<img id="petImg" src="images/unkown.jpg" />
</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>
</html:form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -