<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應用的合稱。 可能你已經見到和使用過Ajax的應用,并且還沒有發現它有什么不足。實際上,Ajax本身有很多限制,它對環境的依賴很強。
    大多數情況是你在一處寫的Ajax無法在別的地方使用,它對瀏覽器,操作系統和后臺程序都有不同的限制和要求。
    人們為了完成各樣環境下的Ajax應用,編寫不了不同的Ajax版本,我也一樣,幸運的是我找到一個可以通行應用于不同環境下的Ajax,我叫它GTAjax。 取這個名字的另外一個原因是,GTAjax 也代表 GridTask Ajax 的意思,因為GTAjax就產生在 gridtask.com


    Feathers / 特征
    GTAjax的特征表現在:
    1. 具有Ajax的功用,可替代Ajax的工作
    2. 其通用性表現在:
    ????a. 與操作系統無關,這應是javascript的本性
    ????b. 與瀏覽器無關,目前我們已經在MSIE,Mozilla firefox,Opera上測試通過
    ????c. 與Web服務器無關, 不依賴于Web服務器的特質去完成任務,可在流行的Apache,IIS等Web server運營的站點使用
    ????d. 與后臺腳本應用程序無關, 也即針對后臺服務器腳本asp,php,jsp,perl等無須做改動
    3. 對Ajax的硬傷--文件上傳作了單獨的優化處理
    4. 代碼精簡,僅有7k左右 , (帶表單驗證有12K)
    5. 使用簡便,可調用操作,設置不同運行參數
    6. 無需設置服務器端,這一點聽起來很荒謬
    7. 表單驗證(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 / 用法
    在您的網頁代碼中加入:[place the following code in your page]
    ....
    <script type="text/javascript" src="GTAjax_.js"></script>
    ....?

    然后寫出自己的業務處理函數[then, write you own functions]:
    ....

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

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

    ....?

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

    <span id="formArea">(請將form放到一個對象中去,place form in a named object)
    <br/>
    <form name="myform" id="myform" action="thisform.do.php" method="post" onsubmit="return false;">(禁用默認遞交,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);"/>(這里的參數是表單名,here give function the form's name)<br/>
    </form>
    </span>  

    ...?

    ok,done.現在,開始吧[now, it is time to go] ....


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

    GTAjax的表單驗證,其配置為:
    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 表單驗證關鍵字描述
    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字符內,則使用表達式, "maxlen=25", 在GTAjax中的完整表達為
    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 //僅為字母和數字(不含符號等)
    num
    numeric
    Check numeric data // 僅為數字
    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. // 其值符合給定的正則表達式
    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" // 這個是 http://www.javascript-coder.com 的標配, 其本身局限大,功能小,舍棄
    notvalue=???

    newlyadded

    Verify the data to be any data other than the specified value // 是上面一個的的升級和擴容,是一個反向概括,如不能讓其值為空"notvalue=" , 不能選擇第一個選項"notvalue=1",用戶名一項的值不能等于初始值"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. // 在寫表單驗證時參考了很多目前流行的,這個就是精簡的結果,比如其中一項,即要符合email地址規范,又不能為空,則 "email+" , 其中一項只能是數字,且不能留空,則 "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后端腳本之aspx
    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. 感謝我的家人,他們更多的操勞才使我有時間寫這些.
    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,我們一起制造了一個表單遞交兩次的嘗試,這個思想對本文影響很大.
    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 環境中的Ajax],Prototype[javascript的擴展庫], W3C, RFC, DOM 和其他許多在網上共享他們的js腳本的人...

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

    Feedback

    # re: GTAjax / 通用Ajax  回復  更多評論   

    2013-05-31 21:58 by ufqi

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

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


    網站導航:
     
    主站蜘蛛池模板: 啦啦啦手机完整免费高清观看| 亚洲毛片在线免费观看| 四虎在线播放免费永久视频| 亚洲精品中文字幕无码A片老| 无码高潮少妇毛多水多水免费| 亚洲综合色7777情网站777| 69成人免费视频| 中文字幕无码精品亚洲资源网久久| 国语成本人片免费av无码| 亚洲精品一二三区| 国产精品无码免费视频二三区| 日韩在线视精品在亚洲| 亚洲七七久久精品中文国产| a毛片免费观看完整| 久久久国产精品亚洲一区| 欧美在线看片A免费观看| 精品国产日韩亚洲一区91| 红杏亚洲影院一区二区三区| 国产一级淫片a免费播放口| 亚洲综合无码一区二区三区| 青娱乐免费视频在线观看| 亚洲aⅴ无码专区在线观看| 久久久久亚洲?V成人无码| 亚在线观看免费视频入口| 亚洲香蕉在线观看| 四虎永久免费观看| 中文字幕乱码一区二区免费| 亚洲第一香蕉视频| 亚洲AV网站在线观看| 最近中文字幕大全免费版在线| 国产精品亚洲自在线播放页码| 免费A级毛片无码久久版| 日韩免费视频一区二区| 亚洲综合成人婷婷五月网址| 亚洲国产一级在线观看| 91高清免费国产自产拍2021| AV激情亚洲男人的天堂国语| 亚洲AV日韩AV鸥美在线观看| 最好免费观看韩国+日本| 在线毛片片免费观看| 亚洲AV无码男人的天堂|