当前位置: 首页 > 图文教程 > 网络编程 > Javascript > Domino中运用jQuery读取视图内容的方法

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 Domino中运用jQuery读取视图内容的方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 323 ::
收藏到网摘: n/a

jQuery是继prototype之后又一个优秀的Javascrīpt框架。其宗旨是——WRITE LESS,DO MORE,写更少的代码,做更多的事情。 jQuery是一个快速的,简洁的javaScript库,使用户能更方便地处理HTML documents、events、实现动画效果,并且方便地为网站或系统提供AJAX交互。
在Domino中应用jQuery框架能够大量简化js代码,并使得js的程序更加简洁和直观,下面是一个简单的例子,在表单中简单运用jQuery来读取视图内容。
1.在表单中加入以下代码并内置HTML:
html 代码:
<input type=button onclick="GetViewContent()" value="获取视图内容">
<div id="ViewContent"></div>
按钮调用函数,div用来接收函数获取到的视图内容,并显示出来。
在表单的jsheader中加入以下JavaScript函数:
复制代码 代码如下:

function GetViewContent(){
var url = 服务器路径/数据库名称/视图名称?readviewentries"
$.get(url,function(data){
var list = "";
list += "<TABLE border='1' cellspacing='0' cellpadding='3' width='100%'><TR><TD><TABLE width='100%' border='1'>"
if($(data).find("viewentry").size == 0){
} else {
$(data).find("viewentry").each(function(){
if($(this).attr("position") < 11) {
$(this).find("entrydata").each(function(){
if ($(this).attr("name")=="name")
list+="<tr><td>"+$(this).text()+"</td><td>"+$(this).next().text()+"</td><td>"+$(this).next().next().text()+"</td></tr>";
})
}
})
}
list += "</TABLE></TD></TR></TABLE>"
$("#ViewContent").html(list);
});
}

注:此代码能成功运行的前提是,在表单中记得调用jQuery.js文件。