欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Domino中運(yùn)用jQuery讀取視圖內(nèi)容的方法

 更新時間:2009年10月21日 22:49:02   作者:  
jQuery是繼prototype之后又一個優(yōu)秀的Javascrīpt框架。其宗旨是——WRITE LESS,DO MORE,寫更少的代碼,做更多的事情。
jQuery是一個快速的,簡潔的javaScript庫,使用戶能更方便地處理HTML documents、events、實現(xiàn)動畫效果,并且方便地為網(wǎng)站或系統(tǒng)提供AJAX交互。
在Domino中應(yīng)用jQuery框架能夠大量簡化js代碼,并使得js的程序更加簡潔和直觀,下面是一個簡單的例子,在表單中簡單運(yùn)用jQuery來讀取視圖內(nèi)容。
1.在表單中加入以下代碼并內(nèi)置HTML:
html 代碼:
<input type=button onclick="GetViewContent()" value="獲取視圖內(nèi)容">
<div id="ViewContent"></div>
按鈕調(diào)用函數(shù),div用來接收函數(shù)獲取到的視圖內(nèi)容,并顯示出來。
在表單的jsheader中加入以下JavaScript函數(shù):
復(fù)制代碼 代碼如下:

function GetViewContent(){
var url = 服務(wù)器路徑/數(shù)據(jù)庫名稱/視圖名稱?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);
});
}

注:此代碼能成功運(yùn)行的前提是,在表單中記得調(diào)用jQuery.js文件。

相關(guān)文章

最新評論