初步使用,有些情况,比jquery 好使
var updater;
function changeUser(newUser, newName) {
$('currentChat').value = "";
targetName = newName;
targetUser = newUser;
$('nameTag').innerHTML = targetName;
updater.stop();
updater = new Ajax.PeriodicalUpdater('currentChat', 'ChatServlet', {
method : 'get',
insertion : Insertion.Bottom,
frequency : pl,
parameters : {
getMessages : targetUser
}
});
}
function populateForm() {
new Ajax.Request('ChatServlet', {
method: 'get',
asynchronous: false,
parameters: {
initConn: 'initConn',
targetUser:targetUser,
userName:userName,
password:password
}
});
new Ajax.Updater('roster', 'ChatServlet', {
method : 'get',
parameters : {
getRoster : 'yes',
userName:userName,
password:password
}
});
updater = new Ajax.PeriodicalUpdater('currentChat', 'ChatServlet', {
method : 'get',
insertion : Insertion.Bottom,
frequency : pl,
parameters : {
getMessages : targetUser,
userName:userName,
password:password
},
onSuccess:function(data,hd){
setTimeout(function(){
var obj = document.getElementById("currentChat");
obj.scrollTop= obj.scrollHeight;
},200);
}
});
$('nameTag').innerHTML = targetName;
}
function sendMessage() {
new Ajax.Request('ChatServlet', {
method : 'get',
parameters : {
target : targetUser,
message : $('newChatText').getValue(),
userName:userName,
password:password
}
});
$('newChatText').value = "";
}
function strdown(event) {
if (event.keyCode == 13) {
//event.keyCode=0; //取消回车
document.getElementById("newChatButton").click();
return false;
}
}
相关推荐
Prototype Ajax学习范例,快速掌握AJAX学习
struts2 prototype ajax验证单个文本框
prototype ajax 简化版本
在Prototype中,与Ajax相关的类和对象包括:Ajax、Ajax.Responsders、 Ajax.Base、Ajax.Request、Ajax. PeriodicalUpdater和Ajax.Updater,图2-3所示为这些类和对象之间的关系及其常用属性和方法,下面分别对这些类...
prototype的Ajax介绍
NULL 博文链接:https://yimeng500.iteye.com/blog/262363
prototype-ajax简单例子,做的不好,大家看看
prototype 是一种开源的AJAX框架
Ajax(Ajax,jquery,prototype综合).rar
NULL 博文链接:https://plane.iteye.com/blog/334832
ajax的一个很好的包 欢迎大家来下载 哈哈
prototype 框架实现ajax实例
prototype ajax 异步刷新 javascript web 2.0
prototype ajax
prototype的ajax应用,prototype的ajax应用
使用prototype操作ajax的例子. 附带prototype.js库
Prototype对Ajax的支持Prototype对Ajax的支持
PROTOTYPE 1.5.1 RC1 API文档 <br>API DOCUMENTATION <br>Welcome to the API documentation for Prototype. The left column contains the main sections. When you activate a section, its detailed ...
《疯狂Ajax讲义:Prototype/jQuery+DWR+Spring+Hibernate整合开发》是《基于J2EE的Ajax宝典》的第二版。《基于J2EE的Ajax宝典》面市近2年,作为Ajax领域最全面、实用的图书,一直深受读者的好评。全书主要分为三个...
资源名称:Ajax实战: Prototype与scriptaculous篇内容简介:这是一本讲述 Prototype和 scriptaculous的实用性极强的综合指南。本书在简要介绍这两个库在宏观应用中的意义之后,再通过 QuickGallery图片...