📄 tryajax.jsp
字号:
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/function.js"></script>
<script type="text/javascript" src="js/ajaxStruts.js"></script>
</head>
<body>
<html:form action="/TryAjax" method="post">
<html:select property="name"/>
<textarea name="value"></textarea>
<button onclick="searchSales()">subajax</button>
<button onclick="dostruts()">struts</button>
</html:form>
<SCRIPT>
var oForm = document.all.TryAjaxForm;
var a = new Ajax.struts.process("TryAjax.do?Action=doAjax","TryAjaxForm");
//a.viewProperty();
function searchSales(){
// var url = 'TryAjax.do?Action=doAjax';
//var pars = 'name='+$("name").value;
//var myAjax = new Ajax.Request(
// url,
// {postBody:Form.serialize("TryAjaxForm"),onComplete: showResponse}
// );
a.submit();
}
var oForm = document.all.TryAjaxForm;
function dostruts(){
//oForm.action = 'TryAjax.do?Action=doAjax';
//oForm.submit();
alert(Form.serialize("TryAjaxForm"));
}
/*
function showResponse(originalRequest)
{
//put returned XML in the textarea
alert(originalRequest.responseText);
$('name').value = eval("("+originalRequest.responseText+")").value[0];
}
*/
</SCRIPT>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -