RICO学习,innerhtml
prototype大家都知道了,是一个优秀的js库,rico也不例外,两者绑定使用效果更强大,具体两者之间的关系,我没有太关注,现在将RICO的innerhtml例子贴出来大家学习,后端使用jsp技术,当然使用asp,php亦可。
inner.html
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
id="personInfo"> Select a name to the left to see the AJAX rolodex entry for the selected person. |
ajaxEngine.registerRequest('getPersonInfo','getPerson.jsp');
ajaxEngine.registerAjaxElement('personInfo');
function getPersonInfo(selectBox){
var firstName = selectBox.value;
ajaxEngine.sendRequest('getPersonInfo',
"firstName=" + firstName);
}
getPerson.jsp
<%@ page language="java" import="java.util.*" contentType="text/xml; charset=ISO-8859-1"%>
<% String firstName = request.getParameter("firstName");
%>
<%=firstName%>1743 1st Avenue Boston,Boston 71204-2345Executive Vice President
Phone #: (972) 555-0293Mobile #: (972) 555-0295Notes: Spouse playes tennis at the country club with John.
inner.html 中select标签的onChange动作调用 getPersonInfo方法,该方法发送请求到已经注册到RICO提供的引擎种的getPerson.jsp,用于调用服务端JSP页面,出现显示效果,当然innerhtml效果是因为jsp中的
对了还要下载rico和 prototype库,和相应的一些CSS文件,css文件只是为了美化布局和美观,可以取掉!
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
