<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 10, 文章 - 0, 評論 - 7, 引用 - 0
    數(shù)據(jù)加載中……

    DWRUtils API 使用方法

    $("precloneNode1suf") 取得該對象;

    DWRUtil.selectRange("selectRangeBasic", 5, 15) 選中selectRangeBasic文本框里面從第五個字符到第15個字符之間的字符.

    DWRUtil._getSelection("selectRangeBasic") 得到selectRangeBasic文本框里選中的字符.

    var arrayFive = [ 'One', 'Two', 'Three', 'Four', 'Five' ];
    DWRUtil.addOptions('addOptionsBasic', arrayFive); 將數(shù)組添加到下拉菜單里面去;

    DWRUtil.getValue('addOptionsBasic') 得到 addOptionsBasic 對象的值;
    DWRUtil.getValue("precloneNode1Inner1suf", { textContent:true }); 后面加個參數(shù),在 precloneNode1Inner1suf元素為"UL" 時(shí),它返回了元素里面得值,也就是說去掉了HTML標(biāo)簽部分.

    DWRUtil.getText('addOptionsBasic') 得到下拉框 addOptionsBasic 顯示的文本;

    var arrayObject = [
    { name:'One', value:'1' },
    { name:'Two', value:'2' },
    { name:'Three', value:'3' },
    { name:'Four', value:'4' },
    { name:'Five', value:'5' }
    ];
    DWRUtil.addOptions('addOptionsObject1', arrayObject, "name"); 將數(shù)組添加到下拉菜單里面去;后面的參數(shù)是確定那個是給用戶顯示的文本,同時(shí)也是值;

    DWRUtil.addOptions('addOptionsObject1', arrayObject, "name","value"); 同上,不過后面參數(shù)是: 3=文本;4=值;

    var map = { one:1, two:2, three:3, four:4, five:5 };
    DWRUtil.addOptions('addOptionsMap1', map); 同上, one 是值;1 是文本;
    DWRUtil.addOptions('addOptionsMap1', map,true); 同上, 1 是值;one 是文本;

    -------------------------------------------------------------------------------------
    <ul id="removeItems">
    <li>One</li><li>Two</li><li>Three</li><li>Four</li><li>Five</li>
    </ul>

    如果是列表顯示,如上;則上面所有方法和select 下拉框使用一樣;
    -------------------------------------------------------------------------------------
    DWRUtil.cloneNode('cloneNode1', { idPrefix:'pre', idSuffix:'suf' });克隆一個節(jié)點(diǎn),參數(shù)一為要克隆的節(jié)點(diǎn)的id,第二個參數(shù)是在克隆的節(jié)點(diǎn)id前面加pre,后面加suf.(注意:如果該節(jié)點(diǎn)有子節(jié)點(diǎn)的話,子節(jié)點(diǎn)的名字也一樣加)

    DWRUtil.addRows(id, array, cellfuncs, [options]);
    原理:

    for each member in array
    for each function in cellfuncs
    create cell from cellfunc(array[i])
    循環(huán)數(shù)組,循環(huán)函數(shù),建立單元調(diào)用函數(shù);(順序決定)

    例如:
    DWRUtil.addRows('addRowsBasic', arrayFive, [
    function(data) { return data; },
    function(data) { return data.toUpperCase(); },
    function(data) {
    var input = document.createElement("input");
    input.setAttribute("type", "button");
    input.setAttribute("value", "DOM Test");
    input.setAttribute("onclick", "alert('" + data + "');");
    return input;
    },
    function(data) { return "<input type='button' value='innerHTML Test' onclick='alert(\"" + data + "\");'>"; }
    ]);

    高級部分:
    第四個參數(shù)為對單元的高級操作,主要下面的兩個方法;
    function defaultRowCreator(options) {
    return document.createElement("tr");
    };

    function defaultCellCreator(options) {
    return document.createElement("td");
    };

    例子:
    DWRUtil.addRows( "demo2",[ 'Africa', 'America', 'Asia', 'Australasia', 'Europe' ] , cellFuncs, {
    rowCreator:function(options) {
    var row = document.createElement("tr");
    var index = options.rowIndex * 50;
    row.style.color = "rgb(" + index + ",0,0)";
    return row;
    },
    cellCreator:function(options) {
    var td = document.createElement("td");
    var index = 255 - (options.rowIndex * 50);
    td.style.backgroundColor = "rgb(" + index + ",255,255)";
    td.style.fontWeight = "bold";
    return td;
    }
    });

    其中 options 參數(shù)的屬性可用的為:(沒試過,自己試試吧)

    rowData: the element value from the array (the same for all cells in a row)
    rowIndex: the key (if map) or index (if array) from the collection
    rowNum: The row number counting from 0 in this section (so if you are using tbody, it counts rows in the tbody and not the whole table)
    data: The 'computed' data value for the cell (cellCreators only)
    cellNum: The cell number that we are altering counting from 0 (cellCreators only)


    DWRUtil.setValues(); 批量設(shè)置值;
    var settings = {
    setValuesDiv:"setValuesDiv",
    setValuesSpan:"setValuesSpan",
    setValuesSelect:"two",
    setValuesText:"setValuesText",
    setValuesPassword:"AB",
    setValuesTextarea:"setValuesTextarea",
    setValuesButton1:"B1-Two",
    setValuesButton2:"B2-Two",
    setValuesRadio1:true,
    setValuesRadio2:false,
    setValuesRadio3:"one",
    setValuesRadio4:"two",
    setValuesCheckbox1:true,
    setValuesCheckbox2:false
    };
    DWRUtil.setValues(settings);

    DWRUtil.getValues(empty);批量獲取值;
    var empty = {
    setValuesDiv:null,
    setValuesSpan:null,
    setValuesSelect:null,
    setValuesText:null,
    setValuesPassword:null,
    setValuesTextarea:null,
    setValuesButton1:null,
    setValuesButton2:null,
    setValuesRadio1:null,
    setValuesRadio2:null,
    setValuesRadio3:null,
    setValuesRadio4:null,
    setValuesCheckbox1:null,
    setValuesCheckbox2:null
    };
    DWRUtil.getValues(empty);

    DWRUtil.useLoadingMessage("Ping");//類似gmail那個樣子,在右上角顯示加載"ping";可用自定樣式,具體查詢;
    http://getahead.ltd.uk/dwr/browser/util/useloadingmessage

    DWRUtil.toDescriptiveString("id",數(shù)字);彈出調(diào)試信息,數(shù)字為0,1,2.一級比一級高.

    DWRUtil.onReturn(event, submitFunction);一般在form表單里面,防止在文本框上按回車就提交表單.
    例如:
    <input type="text"
    onkeypress="DWRUtil.onReturn(event, submitFunction)"/>
    <input type="button" onclick="submitFunction()"/>

    posted on 2007-05-20 12:46 LiuTing 閱讀(619) 評論(1)  編輯  收藏 所屬分類: Ajax學(xué)習(xí)

    評論

    # re: DWRUtils API 使用方法  回復(fù)  更多評論   

    我java方法返回是list,list里面是實(shí)體
    StuBean stu = new StuBean();
    stu.setStuID("1");
    stu.setStuName("java1");
    list.add(stu);
    請問,我在頁面用select如何接收這些值
    2008-01-17 09:33 | 朱盛松

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 成人国产精品免费视频| 精品多毛少妇人妻AV免费久久| 97在线线免费观看视频在线观看| 中文字幕第一页亚洲| 日韩在线观看视频免费| 中文字幕免费在线看| 91麻豆精品国产自产在线观看亚洲 | 老司机亚洲精品影院| 亚洲综合小说久久另类区| 久操视频在线免费观看| 久久久久亚洲AV无码专区体验| 久久免费观看国产99精品| 亚洲日韩区在线电影| 亚洲午夜无码久久久久小说 | 1024免费福利永久观看网站| 天天操夜夜操免费视频| 亚洲小说区图片区另类春色| 怡红院免费的全部视频| 国产精品va无码免费麻豆| 国产偷国产偷亚洲高清在线| 亚洲乱码中文字幕手机在线 | 456亚洲人成在线播放网站| 夭天干天天做天天免费看| 日韩成人精品日本亚洲| av无码久久久久不卡免费网站| 亚洲六月丁香婷婷综合| 啊灬啊灬别停啊灬用力啊免费看| 国产免费播放一区二区| 久久精品亚洲中文字幕无码麻豆| 国产精品美女午夜爽爽爽免费| 国产午夜亚洲精品不卡| 久久夜色精品国产嚕嚕亚洲av| 亚洲一区免费视频| 久久精品国产亚洲AV麻豆~| 亚洲国产精品免费观看| 香蕉视频免费在线播放| 亚洲好看的理论片电影| 日本免费观看网站| 野花香高清视频在线观看免费 | 亚洲人成人网站色www | 亚洲av无码国产精品色在线看不卡|