下载首页下载分类最近更新排 行 榜国产软件国外软件汉化补丁本站论坛BT下载页
  • 设为首页
  • 收藏本站
  • 联系我们
您的位置:首页网页制作JS/Ajax → Xajax中文手册(第一版)
Xajax中文手册(第一版)
出处:本站整理 作者:佚名 日期:2007-5-7 12:12:09 人气: [ ]
如何异步更新内容?
Xajax最富有特色的功能或许就是xajaxResponse类. 其他的Ajax库需要你自己编写JavaScript的回调句柄去处理一个异步请求返回的数据并更新内容. xajax, 从另外一个角度来说, 允许你使用PHP简单的控制内容. xajaxResponse 让你在PHP函数之中创建XML指令返回给你的程序. XML将被xajax的消息分析器解析,指令将告诉xajax如何更新程序的内容和状态. xajaxResponse类目前提供了以下指令:
How do I update my content asynchronously?
Perhaps the most unique feature of xajax is the xajaxResponse class. Other Ajax libraries require you to write your own callback handlers in JavaScript to process the data returned from an asynchronous request and to update the content. xajax, on the other hand, allows you to easily control your content from PHP. The xajaxResponse class allows you to create XML instructions to return to your application from your PHP functions. The XML is parsed by xajax message pump and the instructions tell xajax how to update the content and state of your application. The xajaxResponse class currently offers the following commands:
  • addAssign($sTargetId,$sAttribute,$sData)
    给命名为$sTargetId的元素的$sAttribute属性赋值$sData
$objResponse->addAssign("contentDiv","innerHTML","Some Text");
$objResponse->addAssign("checkBox1","checked","true");
  • addAssign($sTargetId,$sAttribute,$sData)
    Assigns the $sAttribute of the element identified by $sTargetId to $sData
$objResponse->addAssign("contentDiv","innerHTML","Some Text");
$objResponse->addAssign("checkBox1","checked","true");
  • addAppend($sTargetId,$sAttribute,$sData)
    给命名为$sTargetId的元素的$sAttribute属性追加值$sData
$objResponse->addAppend("contentDiv","innerHTML","Some Text");
  • addAppend($sTargetId,$sAttribute,$sData)
    Appends $sData to the $sAttribute of the element identified by $sTargetId
$objResponse->addAppend("contentDiv","innerHTML","Some Text");
  • addPrepend($sTargetId,$sAttribute,$sData)
    预备给命名为$sTargetId的元素的$sAttribute属性赋值$sData
$objResponse->addPrepend("contentDiv","innerHTML","Some Text");
  • addPrepend($sTargetId,$sAttribute,$sData)
    Prepends $sData to the $sAttribute of the element identified by $sTargetId
$objResponse->addPrepend("contentDiv","innerHTML","Some Text");
  • addReplace($sTargetId,$sAttribute,$sSearch,$sData)
    替换命名为$sTargetId的元素的$sAttribute属性的值之中的$sSearch为$sData
$objResponse->addReplace("contentDiv","innerHTML","text","<strong>text</strong>");
  • addReplace($sTargetId,$sAttribute,$sSearch,$sData)
    replaces all instances of $sSearch with $sData in the $sAttribute of the element identified by $sTargetId
$objResponse->addReplace("contentDiv","innerHTML","text","<strong>text</strong>");
  • addClear($sTargetId,$sAttribute)
    清空命名为$sTargetId的元素的$sAttribute属性的值
$objResponse->addClear("Input1","value");
  • addClear($sTargetId,$sAttribute)
    Clears the $sAttribute of the element identified by $sTargetId
$objResponse->addClear("Input1","value");
  • addCreate($sParentId, $sTagname, $sId, $sType)
    在已经存在的命名为$sParentId的元素下添加一个名叫$sTagName的子元素,并且把他的id赋值为$sId,可选的类型赋值为 $sType.
$objResponse->addCreate("form1","input", "pass", "password");
  • addCreate($sParentId, $sTagname, $sId, $sType)
    Adds a new $sTagName child element to an existing element identified by $sParentId, and assigns it the id $sId and the optional type $sType.
$objResponse->addCreate("form1","input", "pass", "password");
  • addRemove($sElementId)
    从你的程序之中移除命名为$sElementId的元素
$objResponse->addRemove("div1");
  • addRemove($sElementId)
    Removes the element identified by $sElementId from your application
$objResponse->addRemove("div1");
  • addAlert($sMsg)
    显示一个内容为 $sMsg 的警告框(JavaScript的Alert)
$objResponse->addAlert("This is some text");
  • addAlert($sMsg)
    Display an alert box with $sMsg
$objResponse->addAlert("This is some text");
  • addScript($sJS)
    执行JavaScript代码 $sJS (演示代码原文有误)
$objResponse->addScript("var txt = prompt('get some text');");
  • addScript($sJS)
    Execute the JavaScript code $sJS
$objResponse->addAlert("var txt = prompt('get some text');");
 
评论人 评论内容摘要(共 0 条,查看完整内容) 得分 0 发表时间
关于本站 | 广告服务 | 版权声明 | 联系我们 | | 联系我 | 交流群:1361692 7710545
本站部分带宽由:华夏名网武汉IDC数据中心 赞助[排名不分先后] Powered By 零度软件园
本站软件均来源于网络,仅供学习所用。若侵犯了你的权益,请立即通知我们,我们将第一时间删除!