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

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

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

    即使世界明天毀滅,我也要在今天種下我的葡萄樹。
    posts - 112, comments - 14, trackbacks - 0, articles - 11

    GTAjax / 通用Ajax

    Posted on 2007-01-24 18:07 閱讀(451) 評論(1)  編輯  收藏
    GTAjax / 通用Ajax ( LastUpdated: 12/04/2006 08:48:27 )
    ?http://www.wadelau.net/index2.html

    Author: Wade Lau, wadelau@ufqi.com, wadelau@hotmail.com

    Summary / 概述
    GTAjax is General-Targeted Ajax. Ajax stands for Asynchronous JavaScript And XML.
    GTAjax is a kind of Ajax, and beyond the Ajax.
    Maybe you have see and have used it in some coding experience. And also, you have not found any inefficent, actually, common Ajax has its own limits in many ways, It depends on the environment heavily.
    Mostly, you code one Ajax which can not run in another place with differences in Browser,Operating System,Bankend programming components,etc...
    In order to comply with the differences, people creates many kinds of Ajax, amd so do I, luckily enough, I found one generally-targeted way to comply with all the differences... , I call it GTAjax. Another reason for this name is GTAjax also refers to GridTask Ajax, based on gridtask.com .

    GTAjax 就是通用(General-Targeted)Ajax的意思。是Ajax的一種. Ajax是異步Javascript和XML應(yīng)用的合稱。 可能你已經(jīng)見到和使用過Ajax的應(yīng)用,并且還沒有發(fā)現(xiàn)它有什么不足。實(shí)際上,Ajax本身有很多限制,它對環(huán)境的依賴很強(qiáng)。
    大多數(shù)情況是你在一處寫的Ajax無法在別的地方使用,它對瀏覽器,操作系統(tǒng)和后臺程序都有不同的限制和要求。
    人們?yōu)榱送瓿筛鳂迎h(huán)境下的Ajax應(yīng)用,編寫不了不同的Ajax版本,我也一樣,幸運(yùn)的是我找到一個(gè)可以通行應(yīng)用于不同環(huán)境下的Ajax,我叫它GTAjax。 取這個(gè)名字的另外一個(gè)原因是,GTAjax 也代表 GridTask Ajax 的意思,因?yàn)镚TAjax就產(chǎn)生在 gridtask.com


    Feathers / 特征
    GTAjax的特征表現(xiàn)在:
    1. 具有Ajax的功用,可替代Ajax的工作
    2. 其通用性表現(xiàn)在:
    ????a. 與操作系統(tǒng)無關(guān),這應(yīng)是javascript的本性
    ????b. 與瀏覽器無關(guān),目前我們已經(jīng)在MSIE,Mozilla firefox,Opera上測試通過
    ????c. 與Web服務(wù)器無關(guān), 不依賴于Web服務(wù)器的特質(zhì)去完成任務(wù),可在流行的Apache,IIS等Web server運(yùn)營的站點(diǎn)使用
    ????d. 與后臺腳本應(yīng)用程序無關(guān), 也即針對后臺服務(wù)器腳本asp,php,jsp,perl等無須做改動(dòng)
    3. 對Ajax的硬傷--文件上傳作了單獨(dú)的優(yōu)化處理
    4. 代碼精簡,僅有7k左右 , (帶表單驗(yàn)證有12K)
    5. 使用簡便,可調(diào)用操作,設(shè)置不同運(yùn)行參數(shù)
    6. 無需設(shè)置服務(wù)器端,這一點(diǎn)聽起來很荒謬
    7. 表單驗(yàn)證(v1.58+)
    GTAjax's feathers include:
    1. do what Ajax can do
    2. its general feather as following:
    ???? a. no mater what OS , inherits from javascript
    ???? b. no matter what Browser, it has been tested pass in MSIE, firefox, Opera
    ???? c. no matter what web server, it can used in Apache, IIS, etc
    ???? d. no matter what backend programming language, it can be used with jsp, asp, php, perl,etc
    3. for Ajax's shortcoming--file upload, it has been optimised to handle files upload correctly
    4. small size, only about 7k , (with form validator up to 12k)
    5. easy to use, with parameters to set for specified running
    6. no action needed with server, which sounds unreasonable
    7. form validator (v1.58+)


    Usage / 用法
    在您的網(wǎng)頁代碼中加入:[place the following code in your page]
    ....
    <script type="text/javascript" src="GTAjax_.js"></script>
    ....?

    然后寫出自己的業(yè)務(wù)處理函數(shù)[then, write you own functions]:
    ....

    function subMyForm(sFrm)
    {
    // before submiting...
    setGTAjax('returnname','Back'); // do settings 設(shè)置環(huán)境變量
    var getTmpStr = GTAjax(sFrm); // main action 調(diào)用主函數(shù)處理并取結(jié)果
    // after submited...
    }

    GTAjax不但能遞交表單,也可處理url請求 [also,GTAjax could handle url request]
    function handleMyUrl(sUrl)
    {
    // before go to next url....
    setGTAjax('targetarea','newdiv');// 設(shè)置將從服務(wù)器端取到的內(nèi)容顯示到新區(qū)域
    //setGTAjax('returndataonly',true);
    setGTAjax('iscache',false); // 設(shè)置是否處理緩存,更多設(shè)置見附后參考[with more settings in the following part]
    var getTmpStr = GTAjax(sUrl); // 主處理函數(shù)
    // after get remote material...
    }  

    ....?

    接著將這些動(dòng)作綁定到對象去[then, bind the function to your target]:
    ....

    <span id="formArea">(請將form放到一個(gè)對象中去,place form in a named object)
    <br/>
    <form name="myform" id="myform" action="thisform.do.php" method="post" onsubmit="return false;">(禁用默認(rèn)遞交,disable the default submit, 1.69+不再做要求)
    <input type="text" id="userName" name="userName" value="Wade Lau"/><br/>
    ....
    <input type="submit" value="Submit" id="btn1" name="btn1" onClick="javascript:subMyForm(this.form.name);"/>(這里的參數(shù)是表單名,here give function the form's name)<br/>
    </form>
    </span>  

    ...?

    ok,done.現(xiàn)在,開始吧[now, it is time to go] ....


    Reference and Download / 參考和下載
    @ GTAjax運(yùn)行時(shí)配置參考[settings references]:
    ....
    setGTAjax('subbtnval','Submit'); // 表單遞交按鈕顯示的字符,默認(rèn)是Submit
    setGTAjax('maxuploadfiletime',3*60*1000); // 上傳文件等待回應(yīng)的最大時(shí)間,默認(rèn)是3分鐘
    setGTAjax('targetarea','areaname'); // 遞交請求獲取數(shù)據(jù)后寫在當(dāng)前頁面的何處,默認(rèn)是遞交元素所在的區(qū)域
    setGTAjax('returnname','Return'); // 表單遞交后,返回鏈接的顯示字符,默認(rèn)是Return
    setGTAjax('returndataonly',false); // 是否僅僅取得返回?cái)?shù)據(jù)(而不向目標(biāo)區(qū)域?qū)懭?,默認(rèn)是false
    setGTAjax('iscache',true); // 是否緩存從服務(wù)器取得的內(nèi)容,默認(rèn)是true
    setGTAjax('forceframe',false); // 是否強(qiáng)制使用iframe技術(shù),即便沒有fileupload行為也不使用xmlhttp,在一些xmlhttp受限的地方可使用iframe代替
    setGTAjax ('processbar',true); // 是否顯示處理中提示條, 默認(rèn)是顯示 (1.89+, idea from ayg at founder dot com)
    setGTAjax ('backlink',true); // 是否在返回內(nèi)容中追加返回鏈接,默認(rèn)為是(1.89+ )
    setGTAjax('forceframetag','fftag'); //告知服務(wù)器端,此次請求是普通請求,非xmlhttp,服務(wù)器端可據(jù)此fftag=1來判斷(1.91+)
    setGTAjax('chkform','userMail:email+:user mail should be an valid email address'); // 設(shè)定表單遞交驗(yàn)證項(xiàng)(詳細(xì)見下表)
    ....

    GTAjax的表單驗(yàn)證,其配置為:
    setGTAjax('chkform','userMail:email+:user mail should be an valid email address');
    其中'chkform' : tell GTAjax to validate form data.
    'userMail:	email+:		user mail should be an valid email address'
    'strFormFieldName:formValidateType:	errorMessage'
    
    GTAjax Form Validation Descriptors // GTAjax 表單驗(yàn)證關(guān)鍵字描述
    formValidateTypeExplainations[partly from http://www.javascript-coder.com ]
    required
    req
    The field should not be empty // 不能為空
    maxlen=???
    maxlength=???
    checks the length entered data to the maximum. For example, if the maximum size permitted is 25, give the validation descriptor as "maxlen=25" // 長度檢測,至多允可長度, 如欲限定在25字符內(nèi),則使用表達(dá)式, "maxlen=25", 在GTAjax中的完整表達(dá)為
    setGTAjax('chkform','strField:maxlen=25:this field max length is 25.');
    minlen=???
    minlength=???
    checks the length of the entered string to the required minimum. example "minlen=5" //最小限定為
    alphanumeric
    alnum
    Check the data if it contains any other characters other than alphabetic or numeric characters //僅為字母和數(shù)字(不含符號等)
    num
    numeric
    Check numeric data // 僅為數(shù)字
    alpha
    alphabetic
    Check alphabetic data. // 僅為字母
    email The field is an email field and verify the validity of the data. // 限為合法email地址
    lt=???
    lessthan=???
    Verify the data to be less than the value passed. Valid only for numeric fields.
    example: if the value should be less than 1000 give validation description as "lt=1000" // 其值不小于
    gt=???
    greaterthan=???
    Verify the data to be greater than the value passed. Valid only for numeric fields.
    example: if the value should be greater than 10 give validation description as "gt=10" // 其值不大于
    regexp=??? Check with a regular expression the value should match the regular expression.
    example: "regexp=^[A-Za-z]{1,20}$" allow up to 20 alphabetic characters. // 其值符合給定的正則表達(dá)式
    dontselect=??

    ?Deprecated

    This validation descriptor is valid only for select input items (lists) Normally, the select list boxes will have one item saying 'Select One' or some thing like that. The user should select an option other than this option. If the index of this option is 0, the validation description should be "dontselect=0" // 這個(gè)是 http://www.javascript-coder.com 的標(biāo)配, 其本身局限大,功能小,舍棄
    notvalue=???

    newlyadded

    Verify the data to be any data other than the specified value // 是上面一個(gè)的的升級和擴(kuò)容,是一個(gè)反向概括,如不能讓其值為空"notvalue=" , 不能選擇第一個(gè)選項(xiàng)"notvalue=1",用戶名一項(xiàng)的值不能等于初始值"notvalue=用戶名"...
    (anyofabove)+

    newlyadded

    the "+" means req, or required, not empty when added up to any type of validating above, e.g. "email+" which means the expected value is an email address, and the field also is required, not empty. // 在寫表單驗(yàn)證時(shí)參考了很多目前流行的,這個(gè)就是精簡的結(jié)果,比如其中一項(xiàng),即要符合email地址規(guī)范,又不能為空,則 "email+" , 其中一項(xiàng)只能是數(shù)字,且不能留空,則 "num+",...


    < 下載/Download
    2006.10.12, GTAjax/通用Ajax-1.91
    2006.09.22, GTAjax/通用Ajax-1.89
    2006.07.25, GTAjax/通用Ajax-1.86
    2006.07.07, GTAjax/通用Ajax-1.72
    2006.05.23, GTAjax后端腳本之a(chǎn)spx
    2006.05.23, GTAjax后端腳本之php
    2006.03.22, GTAjax/通用Ajax-1.69
    2006.03.15, GTAjax/通用Ajax-1.58, with form validator.
    2006.03.12, GTAjax/通用Ajax-1.36
    2006.02.17, GTAjax/通用Ajax-1.28


    Thanks and Declarations / 致謝與聲明
    I wanna say THANKS :
    to my home, they do more and spare me to have time code these. 感謝我的家人,他們更多的操勞才使我有時(shí)間寫這些.
    to Google, without its motivation, I have no idea about Ajax, and without it, I hardly complete this code.感謝Google,因其而起而又得其力.
    to dong_li98@hotmail.com, we do together an exciting action by submitting a form twice with javascript, which contributes mainly to this script. 感謝dong_li98@hotmail.com,我們一起制造了一個(gè)表單遞交兩次的嘗試,這個(gè)思想對本文影響很大.
    to AjaxAnywhere[JSP based Ajax], to Prototype[javascript extend library], to W3C, to RFC, to DOM, to lots of people who works on js and share their scripts with us ... 還要感謝AjaxAnywhere[jsp 環(huán)境中的Ajax],Prototype[javascript的擴(kuò)展庫], W3C, RFC, DOM 和其他許多在網(wǎng)上共享他們的js腳本的人...

    NOTICE:
    DO NOT USE THIS COMMERICALLY WITHOUT AUTHOR'S PAPER AUTHORIZATION.僅供個(gè)人免費(fèi)使用,請勿復(fù)制用于商業(yè)獲利.
    if needed, please contact with us at mailto:wadelau@ufqi.com?subject=GTAjax 如有必要請聯(lián)絡(luò) mailto:wadelau@ufqi.com?subject=GTAjax 獲取授權(quán).
    ?

    Feedback

    # re: GTAjax / 通用Ajax  回復(fù)  更多評論   

    2013-05-31 21:58 by ufqi

    好像有新的更新, http://ufqi.com/dev/gtajax

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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 午夜亚洲国产成人不卡在线| 免费人成视频在线| 16女性下面无遮挡免费| 100000免费啪啪18免进| 成人毛片免费在线观看| 亚洲精品乱码久久久久久蜜桃| 国产亚洲人成网站观看| 亚洲国产精品成人精品小说| 亚洲日韩精品无码专区加勒比| 香蕉视频免费在线| 日本在线免费观看| 毛片在线看免费版| 亚洲午夜爱爱香蕉片| 亚洲人成网www| 亚洲av中文无码字幕色不卡| 精品国产免费一区二区三区| 免费国产99久久久香蕉| 日本三级2019在线观看免费| 亚洲成AV人在线观看网址| 久久亚洲中文字幕精品有坂深雪| 亚洲精品人成网在线播放影院| 无码日韩人妻AV一区免费l| 久草视频在线免费看| 免费观看毛片视频| 亚洲人成中文字幕在线观看| 亚洲最大的黄色网| h视频在线免费观看| 久热中文字幕在线精品免费| 日本中文一区二区三区亚洲| 97se亚洲综合在线| 真人无码作爱免费视频| 日韩在线永久免费播放| 四虎影视永久免费观看| 内射少妇36P亚洲区| 阿v免费在线观看| 精品久久8x国产免费观看| 亚洲国产精品第一区二区三区| 亚洲视频小说图片| 一级人做人爰a全过程免费视频| 亚洲三级在线免费观看| 在线观看亚洲av每日更新|