面向Java开发人员的Ajax技术[18]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

在列表3中,你已看到通过调用函数getReadyStateHandler()创建了一个处理函数,并被配置给onreadystatechange属性。getReadyStateHandler()使用了这样的事实:函数是JavaScript中的主要对象。这意味着,函数可以作为参数被传递到其它函数,并且可以创建并返回其它函数。getReadystateHandler()要做是就是返回一个函数,来检查XMLHttpRequet是否已经完成处理,并传递XML服务器响应到由调用者指定的处理函数。列表6getReadyStateHandler()的代码。

列表6:函数getReadyStateHandler()

/*

 * Returns a function that waits for the specified XMLHttpRequest

 * to complete, then passes its XML response to the given handler function.

 * req - The XMLHttpRequest whose state is changing

 * responseXmlHandler - Function to pass the XML response to

 */

function getReadyStateHandler(req, responseXmlHandler) {

  // 返回一个监听XMLHttpRequest实例的匿名函数

本文关键:面向Java开发人员的Ajax技术
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top