testajax.jsp

来自「A pet management. To do a project like t」· JSP 代码 · 共 47 行

JSP
47
字号
<%@ page language="java" pageEncoding="GB18030"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'testAjax.jsp' starting page</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">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<input id="jbutton" type="button" value="ιʳ" onclick="feed(16)"/>
		<div id="jdiv">aaa</div>
		<script>
		var pet = null;
		location="queryrst.jsp?page="+select.options[selectedIndex].value;
		function feed(petId)
		{
			if (!pet) {
				IPetBusiness.getPetinfo(petId,feedcallback);
			} else {
				pet.petStrength = pet.petStrength+30;
				IPetBusiness.updatePetinfo(pet);
			}	
		}
		function feedcallback(msg)
		{
			pet = msg;
			pet.petStrength = pet.petStrength+30;
			IPetBusiness.updatePetinfo(pet);
		}
		</script>
	</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?