WEB开发网      婵犵數濮烽弫鍛婃叏閻戣棄鏋侀柛娑橈攻閸欏繘鏌i幋锝嗩棄闁哄绶氶弻娑樷槈濮楀牆濮涚紓浣哄█缁犳牠寮诲鍫闂佸憡鎸诲銊╁箲閵忕姭妲堟繛鍡樺姇椤庢捇姊洪崨濠傚鐎殿喖鐖奸獮鏍箛椤旂偓锛忛梺鍛婃寙閸曨偅鐣梻浣哥枃椤宕归崸妤€绠栭柍鍝勫暊閸嬫捇宕烽鐐愩垺銇勯妷锔剧疄婵﹤鎼晥闁搞儜鈧崑鎾澄旈崨顓狅紱闂佽宕橀褎顢婇梻浣告啞濞诧箓宕归幍顔句笉婵炴垯鍨洪悡鏇熴亜閹板墎绋荤紒鈧崘鈹夸簻閹艰揪绱曟晥濠殿喖锕ㄥ▍锝囧垝濞嗗繆鏋庨柟顖嗗啫顥愰梻鍌欑閹芥粍鎱ㄩ悽绋跨婵炲棙鍔掔换鍡涙煟閵忊懚鍦矆鐎n偁浜滈柡宥冨姀婢规﹢鏌涢悙顏勫婵﹥妞藉Λ鍐归妶鍡欌姇闁瑰嘲鎳橀獮鎾诲箳瀹ュ拋妫滈梻鍌欑濠€閬嶅磿閵堝鈧啴宕卞☉妯煎幈闂佸湱鍎ら〃鍡涙偂閺囥垺鐓涢柛銉e劚婵$厧霉濠婂嫮鐭嬮柕鍥у缁犳盯鏁愰崨顓犵潉闂備礁鎼径鍥焵椤掆偓绾绢參寮抽崱娑欏€甸柨婵嗛婢т即鏌¢崱娆忊枅闁哄睙鍕嚤婵炲棙鍨甸崺宀勬⒑闂堟稒顥為悽顖涘浮閿濈偛鈹戠€n偄浜楅柟鑹版彧缁插ジ鎮介懡銈囩=濞达綀顕栧▓鏇㈡煕閵娿儳浠㈡い顐㈢箳缁辨帒螣鐠囧樊鈧挾绱撴担鍦槈妞ゆ垵鎳庨埢鎾活敇閻愨晜鏂€濡炪倖姊归弸濠氬礂椤掑倻纾奸柣妯挎珪瀹曞矂鏌曢崱鏇狀槮妞ゎ偅绻堥獮鍥ㄦ媴閸忓鐎告繝鐢靛Х閺佸憡鎱ㄩ銏犵;闁规崘绉ぐ鎺撴櫜闁搞儮鏂傞埀顒€锕弻锟犲焵椤掍胶顩烽悗锝庡亞閸樿棄鈹戦埥鍡楃仭妞ゆ垶鐟╁畷鐢碘偓锝庡厴閸嬫挾鎲撮崟顒€浠╅梺绋挎唉缁箖鎮橀崘顔解拺缂備焦鈼ら鍕靛殨闁割偅娲栭悿顕€鏌i幇顔芥毄缁炬儳銈搁弻娑氫沪閻愵剛娈ら柡浣哥墦閹鎲撮崟顒傤槰缂備緡鍠栫换妯挎闁诲酣娼ч幗婊兾涢鐐寸厵妞ゆ牕妫旂粈浣圭椤曗偓閹鈻撻崹顔界亪闂佺粯鐗滈崢褔鎮鹃悜鑺ュ亗閹煎瓨蓱椤秴鈹戦埥鍡楃仧閻犫偓閿曞倹鍊电€规洖娲ㄧ壕浠嬫煕鐏炲墽鎳呴柛鏂跨У閵囧嫰濡搁妷锔绘闂佷紮绲剧换鍫ョ嵁閺嶃劍濯存慨婵嗘湰閹蹭即姊绘担铏瑰笡婵☆偄鍟磋棢闁规崘顕уЧ鏌ユ倵閿濆骸鏋熼柣鎾跺枑娣囧﹪濡堕崒姘闂備胶绮〃鍛涘Δ鍛厺闁圭偓绶為弮鍫濆窛妞ゆ棁顫夌€氬ジ姊洪懡銈呅㈡繛鑼█閸┾偓妞ゆ帒鍟悵顏堟煟韫囧﹤浜鹃梻鍌氬€风粈渚€骞栭锕€绠犻柟閭﹀幗閸欏繘鏌熺紒銏犳灍闁稿鏅犻弻锝夊Χ鎼达紕浠滄繛瀛樼矊缂嶅﹪寮婚悢鍏煎€绘俊顖濆亹閻f椽姊洪崫鍕櫤缂佽鐗嗛~蹇撁洪鍜佹濠电偞鍨堕懝楣冦€傞崫鍕ㄦ斀闁宠棄妫楁禍婵嬫煟閻斿弶娅婇柕鍡曠閳诲酣骞掗弮鍌涙緫闂備礁鎼崯顐﹀磹婵犳碍鍎婇柛顐犲劜閳锋垶鎱ㄩ悷鐗堟悙闁诲繐寮剁换娑欐媴閸愭彃顏い鈺冨厴閺屻劑寮撮悙娴嬪亾瑜版帗鍋傞柡鍥ュ灪閻撳繐鈹戦悙鑼虎闁告柣鍊濋弻娑㈠煛鐎n剛蓱濡炪們鍔婇崕鐢稿箖濞嗘挸绾ч柟瀛樼箥濞兼碍淇婇妶鍥ラ柛瀣仱閺佸啴濮€閵堝啠鍋撴担绯曟瀻闁圭偓娼欏▓鎰版⒑閸愬弶鎯堟い鎴濇喘閻涱噣濮€閵堝棌鎷婚梺绋挎湰閻燂妇绮婇悧鍫涗簻妞ゆ劑鍩勫Σ鎼佹煟閿濆懎妲婚摶锝夋煠濞村娅囬柣鎾愁儏椤啴濡堕崱姗嗘⒖闂佽法鍠嗛崕鑼矉瀹ュ牄浜归柟鐑樻尵閸樼敻姊虹紒妯虹仸閽冮亶鎮樿箛锝呭箹闂囧绻濇繝鍌氭殶缂佸鍎ら幈銊︾節閸涱噮浠╃紓浣介哺鐢帟鐏掗梺鎯х箻閳ь剚绋掗、姗€姊婚崒娆戝妽閻庣瑳鍏犲搫顓兼径濠勬煣濠电偞鍨剁划搴㈢闁秵鈷掑ù锝呮啞閸熺偞绻涚拠褏鐣电€规洖缍婇弻鍡楊吋閸涱垰骞堥梻浣侯攰閹活亪姊介崟顖涘亗婵炲棙鎸婚悡鐘崇箾閺夋埈鍎愭繛鍛噹闇夐柣妯虹-閻﹪鏌嶇憴鍕伌闁搞劑绠栭幃娆撴寠婢跺鍨濋梻鍌欐祰椤曟牠宕板Δ鍛偓鍐川閺夋垹鍙€婵犮垼鍩栭崝鏇犵不閹惰姤鐓欓柟顖嗗苯娈堕悷婊勬緲濞层劎妲愰幘璇茬<婵炲棙鍨肩粣妤呮⒑閸濄儱校闁绘濞€閵嗕線寮介鐐茬獩闂佸湱鈷堥崢浠嬪疾閿濆鈷戠紒瀣硶缁犳娊鏌涘Ο鐘叉噺椤愪粙鏌i幇顔剧瘈缂佽妫欓妵鍕冀閵娧呯厒闁汇埄鍨辩粙鎺旀崲濞戙垹宸濇い鎾跺枎閺嬬姴鈹戦纭峰姛缂侇噮鍨堕獮蹇涘川鐎涙ê浠梻渚囧弿缁犳垵鈻撳┑鍫㈢=闁稿本鐟︾粊鐗堛亜閺囧棗娲ょ壕褰掓煕椤垵娅橀柛銈嗘礈缁辨挻鎷呯拹顖滅窗缂備讲妾ч崑鎾绘⒒娴h鍋犻柛搴灦瀹曟繂顓奸崨顏呯€洪梺鎼炲労閸撴岸鍩涢幋鐘电<閻庯綆鍋勯婊勭節閳ь剟骞嶉鍓э紲闁诲函缍嗛崑鍛暦瀹€鈧埀顒冾潐濞插繘宕规禒瀣畺濞寸姴顑呭婵嗏攽閻樻彃顏╂鐐搭殜濮婃椽鎮烽弶鎸庡€梺浼欑秵娴滎亜鐣风憴鍕瘈婵﹩鍓涢崢鎰版⒑閸濆嫭鍌ㄩ柛銊︽そ閹繝濡烽敂钘夊伎濠碘槅鍨伴悘婵嬫偂閹扮増鐓熼柟鎹愭硾閺嬫盯鏌i幙鍐ㄤ喊鐎规洖鐖兼俊鐑藉Ψ閵夈儛鎴犵磽閸屾瑧顦︽い鎴濈墕閻g兘鎮介崹顐綗闂佸湱鍎ゅ鑽ゅ閸忛棿绻嗘い鏍ㄧ箓娴滃綊鏌i敐鍫燁仩缂佽鲸鎸婚幏鍛存惞閻熸壆顐肩紓鍌欐祰椤曆囨偋閸℃稒鍋╃€瑰嫰鍋婂ḿ銊╂煃瑜滈崜姘┍婵犲偆娼扮€光偓婵犲唭銊х磽閸屾瑦绁板鏉戞憸閹广垽宕煎┑鎰稁缂傚倷鐒﹁摫濠殿垰顕槐鎺戔槈濮楀棗鍓板┑鐐茬墛閸旀瑥顫忓ú顏勭闁绘劖褰冮‖鍡涙⒑閸涘⿴娈旈柛鐔锋健閹箖鎮滅粵瀣櫖闂佺粯鍔樼亸娆愵殽閸ヮ剚鈷戦柣鐔煎亰閸ょ喎鈹戦鈧ḿ褔鍩㈤幘娣亝闁告劏鏂侀幏铏圭磽閸屾瑧鍔嶉拑閬嶆煃闁垮娴柡灞界Т閻o繝骞嶉灏栧徍闁诲孩顔栭崳顕€宕戞繝鍌滄殾闁圭儤顨嗛崐鐑芥倵閻㈢櫥褰掔嵁閸儲鈷掑ù锝囨嚀閳绘洟鏌℃笟鍥ф珝鐎规洘鍨块獮妯肩磼濡厧骞愰梻浣告啞娓氭宕板璺虹疇闁告侗鍠曠换鍡涙煕濞嗗浚妲稿┑顔兼喘閹藉爼鏁愭径瀣哗濠电偞鍨剁敮鎺撴櫠閺屻儲鐓涢柛灞绢殔娴滈箖姊婚崒姘偓鐑芥嚄閸撲礁鍨濇い鏍仜缁€澶愭煛閸モ晛鈧綁鎮㈤崫銉х槇闂佹悶鍎滈崘鈺佸姃闂傚倷鑳剁划顖炲蓟閵娾晜鍎嶆繝闈涱儏缂佲晠鏌ら幁鎺戝姌濞存粍绮撻弻锟犲礃閵婏箑顦╁銈冨劚椤︾敻寮诲☉銏犳閻犲洦绁撮崑鎾斥攽鐎n亞顔戦梺鍓插亝濞叉﹢宕愰悜鑺ョ厽闁瑰鍋嶇紓姘舵煕濮椻偓娴滆泛顫忓ú顏勪紶闁告洦鍓欓崑宥夋⒑閸涘﹥鐓ラ柡鍫墴瀵煡宕奸弴銊︽櫖闂佺粯鍔曢顓㈠储閸楃偐鏀介柣鎰级椤ユ粎绱掔紒妯虹缂侇喚绮换婵嗩潩椤撶姴骞愰梺璇茬箳閸嬬喖寮查锝嗘珡闂佽姘﹂~澶娒洪敃鍌氱;濠电姴鍊婚弳锕傛煟閺冨倵鎷¢柡浣告閺屽秷顧侀柛鎾寸懇閸┿垹顓兼径瀣珳闂佹悶鍎弲婵嬫晬濠靛洨绠鹃弶鍫濆⒔缁嬭崵鎲搁弶鍨殲缂佸倸绉归幃娆擃敆閸屾粎妲囬梻渚€娼ф蹇曞緤閸撗勫厹闁绘劦鍏欐禍婊堟煙鐎涙ḿ绠栫€瑰憡绻勭槐鎺楊敊閸撗冪闂侀潧鐗炵紞浣哥暦濮椻偓閸╋繝宕橀妸銉ь吋闂傚倷娴囬褏鈧稈鏅濈划娆撳箳閹寸姴绠甸柣鐘充航閸斿孩绋夊鍡樺弿婵$偠顕ф禍楣冩⒑閸濆嫯顫﹂柛鏂跨焸閸┿儲寰勬繛銏㈠枑瀵板嫰鎯傞崫銉戦梺闈涙搐鐎氱増淇婇幖浣规櫜闁告侗鍘艰闂傚倷娴囬鏍窗濡ゅ懏鍋¢柍鍝勬噷閳ь兛绶氬顕€宕煎┑鍫Ч婵$偑鍊栭幐鑽ゆ崲閸曨厾鐭嗛柛鏇ㄥ灡閳锋帡鏌涚仦鍓ф噭缂佷胶澧楅妵鍕即閻斿搫鈷岄悗瑙勬磻閸楀啿顕f禒瀣垫晝闁靛牆娴傚Σ绋库攽閻樺灚鏆╁┑顔芥尦瀹曟劖绻濆顒佽緢闂佹寧娲栭崐褰掓偂濞嗘劑浜滈柡宥庡亜娴犳粌霉濠婂懎顣煎ǎ鍥э躬閹崇姵锛愬┑鍡橆唲闂備礁鐤囬~澶愬垂閸ф鏄ラ柛鏇ㄥ灠缁€鍐煏婵炑冩噷閸嬧€斥攽閿涘嫬浜奸柛濞垮€濆畷銏°偅閸愩劎顦у┑鈽嗗灟鐠€锕傚吹閺囥垺鍋i柛銉e妿閵堝瓨淇婇幓鎺斿ⅵ闁哄本娲濈粻娑㈠即閻戝棙缍岄梻浣稿暱閹碱偊骞婅箛娑欏亗闊洦鎼╅悢鍡涙偣妤︽寧顏犲褎娲熼弻娑㈠籍閳ь剟骞愰幎钘夎摕婵炴垯鍨瑰Λ妯荤箾閸℃瑥浜惧Δ鏃傜磽閸屾瑦绁板瀛樻倐楠炴劖绻濆顒傤唵闂佸憡渚楅崹鎶芥儗濞嗘挸绠归悗娑櫳戠亸顓灻瑰⿰鍫㈢暫闁哄本绋戦埞鎴﹀礋椤愩垹袘闂備焦妞块崢浠嬪箰妤e啫绠熼柟闂寸劍閸嬪鏌涢锝囩畼闁荤喆鍔戝娲传閸曢潧鍓紓浣藉煐瀹€绋款嚕婵犳碍鍋勯柣鎾虫捣椤︻參鎮峰⿰鍐闁轰緡鍠栭埥澶愬閿涘嫬骞愰梻浣告啞娓氭宕板Δ鍛9闁规壆澧楅悡娑㈡倶閻愰鍤欏┑顔煎€块弻鐔碱敊閸濆嫧鍋撳┑鍡欐殾闁圭儤鍨熷Σ鍫熸叏濡も偓濡梻妲愰敓锟� ---闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁炬儳缍婇弻锝夊箣閿濆憛鎾绘煕婵犲倹鍋ラ柡灞诲姂瀵噣宕奸悢鍛婎唶闂備胶枪椤戝棝骞愰崜褍鍨濇い鎾跺亹濡插牊淇婇姘儓缂佺姾顕ч埞鎴︽倷閸欏鏋欐繛瀛樼矋缁捇骞冮垾鏂ユ闁靛骏绱曢崢鍗炩攽閻愭潙鐏ョ€规洦鍓熼悰顔嘉熷Ч鍥︾盎闂佸搫鍊圭€笛囁夐姀鈩冨弿濠电姴鎳忛鐘绘煙閻熸澘顏┑鈩冩倐婵$兘鏁傞幆褏绋堥梻鍌氬€烽懗鍫曞箠閹捐鍚归柡宥庡幖缁狀垶鏌ㄩ悤鍌涘
开发学院WEB开发Ajax AJAX实现的多人协同设计 阅读

AJAX实现的多人协同设计

 2009-10-28 11:17:59 来源:WEB开发网 闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁惧墽鎳撻—鍐偓锝庝簻椤掋垺銇勯幇顖毿撻柟渚垮妼椤粓宕卞Δ鈧獮濠勭磽閸屾艾鈧懓顫濋妸鈺佺疅缂佸顑欓崥瀣煕椤愵偅绶氱紓鍐╂礋濮婂宕掑▎鎴М濠电姭鍋撻梺顒€绉甸幆鐐哄箹濞n剙濡肩紒鎰殜閺屸€愁吋鎼粹€茬敖婵炴垶鎸哥粔鐢稿Φ閸曨垰鍐€妞ゆ劦婢€濞岊亪姊虹紒妯诲蔼闁稿海鏁诲濠氭晲婢跺﹤宓嗛梺缁樺姈缁佹挳宕戦幘璇叉嵍妞ゆ挻绋戞禍鐐叏濡厧浜鹃悗姘炬嫹闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁惧墽鎳撻—鍐偓锝庝簼閹癸綁鏌i鐐搭棞闁靛棙甯掗~婵嬫晲閸涱剙顥氬┑掳鍊楁慨鐑藉磻濞戔懞鍥偨缁嬫寧鐎梺鐟板⒔缁垶宕戦幇鐗堢厵缂備焦锚缁椦囨煃瑜滈崜锕傚矗閸愵煈娼栭柛婵嗗珔瑜斿畷鎯邦槾濞寸姴銈稿铏规嫚閼碱剛顔夐梺鐓庣秺缁犳牠骞冩ィ鍐╁€婚柦妯侯槼閹芥洟姊洪棃娑辨濠碘€虫喘瀹曘垽鎮介崨濞炬嫼闁荤喐鐟ョ€氱兘宕箛娑欑厱闁绘ê纾晶鐢告煏閸℃鈧湱缂撴禒瀣窛濠电姴瀚獮鍫ユ⒑绾懎顥嶉柟娲讳簽濡叉劙寮撮悢鍝勨叞闂傚倸鍊风欢姘缚瑜嶇叅闁靛牆娲犻崑鎾愁潩椤愩垹绁梺缁樹緱閸o綁鐛幒鎳虫棃鍩€椤掑倻涓嶉柨婵嗘缁♀偓闂傚倸鐗婄粙鎴﹀汲濞嗗緷鐟扳堪閸垻鏆梺鍝勭焿缂嶄焦鎱ㄩ埀顒勬煃閹増纭炬繝鈧潏銊х彾闁哄洨鍠撶弧鈧┑顔斤供閸橀箖宕㈤悽鍛娾拺缂備焦锚婵箓鏌涢幘鏉戝摵闁诡喗蓱濞煎繘濡搁妶鍥╃暰闂備礁婀辩划顖滄暜閻愬瓨娅犳繛鎴炴皑绾捐偐绱撴担璐細婵炴彃顕埀顒冾潐濞叉牕鐣烽鍐簷闂備礁鎲¢崝鏇㈠疮閻樿绀堟繝闈涚墛瀹曞弶绻涢幋鐐ㄧ細闁哄棗妫楅埞鎴︽偐鏉堫偄鍘¢梺杞扮劍閻楁粎妲愰幘瀛樺濞寸姴顑呴幗鐢告⒑閸︻厽鍤€婵炲眰鍊濋幃楣冩倻閽樺顔婇梺瑙勬儗閸樹粙宕撻悽鍛娾拺闁荤喐婢橀幃渚€鏌i幒鐐电暤闁诡喗顨婇獮鏍ㄦ媴閸忓瀚藉┑鐐舵彧缁插潡宕曢妶澶婂惞闁逞屽墴濮婃椽骞栭悙娴嬪亾閺嶎厽鍋嬮柣妯垮吹瀹撲線鐓崶銊р姇闁哄懏鎮傞弻銊╂偆閸屾稑顏�婵犵數濮烽弫鍛婃叏閻戣棄鏋侀柛娑橈攻閸欏繘鏌i幋锝嗩棄闁哄绶氶弻娑樷槈濮楀牊鏁鹃梺鍛婄懃缁绘垿濡甸崟顖氱闁告鍋熸禒鑲╃磽娴e搫顎岄柛銊ョ埣瀵鈽夐姀鐘电杸闂傚倸鐗婄粙鎺楁倶閸儲鍊甸柣鐔哄閸熺偟绱掔拠鎻掓殻濠碉紕鏁诲畷鐔碱敍濮橀硸鍟嬮梺璇查叄濞佳囧箺濠婂牊鍋╁┑鍌氭啞閳锋垹鐥鐐村婵炲吋鍔栫换娑㈡嚑椤掆偓閺嬪孩銇勯銏㈢缂佽鲸甯掕灒闁兼祴鏅滈崵宀勬⒒娓氣偓閳ь剛鍋涢懟顖涙櫠椤旇偐鏆嗛柨婵嗙墕閸斿灚銇勯敂鐣屽弨闁诡噯绻濇俊鑸靛緞鐎n剙甯鹃梻浣稿閸嬪懐鎹㈤崘顔肩;妞ゅ繐鎳愮粻鍓р偓鐟板閸犳洜鑺辨繝姘畾闁绘柨鍚嬮埛鎴︽倵閸︻厼校闁靛棗鍟撮弻銈夊礃閼碱剙鐓熼悗瑙勬礃缁诲牓寮崘顔肩劦妞ゆ帒瀚ч埀顒佹瀹曟﹢顢欓崲澹洦鐓曢柍鈺佸枤濞堟﹢鏌i悢绋垮婵﹥妞介幃鈩冩償閳╁啯鐦i梻浣虹帛閻楁洟濡剁粙璺ㄦ殾闁绘垶岣跨弧鈧梺鎼炲劀閸愩劎銈梻鍌欑窔濞佳勵殽韫囨洘顫曢柡鍥ュ灩閸屻劍銇勮箛鎾跺闁抽攱鍨块弻鐔兼嚃閳轰椒绮堕梺鍛婃⒐椤ㄥ﹪寮婚敓鐘插窛妞ゆ棃鏁慨鍥╃磽娴gǹ鈧湱鏁悢濡撳洨鈧潧鎽滅壕濂稿级閸稑濡肩紒妤佺缁绘盯鎮℃惔锝囶啋闂佺硶鏂侀崜婵嬪箯閸涘瓨鐓ラ悗锝呯仛缂嶆姊婚崒姘偓宄懊归崶褜娴栭柕濞炬櫆閸婂潡鏌ㄩ弴鐐测偓鍝ョ不閺屻儲鐓曢柕澶樺枛婢ь噣鏌$€b晝绐旈柡宀€鍠栧畷婊嗩槾閻㈩垱鐩弻锟犲川椤旇棄鈧劙鏌$仦璇插闁诡喓鍊濆畷鎺戔槈濮楀棔绱�闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁惧墽鎳撻—鍐偓锝庝簻椤掋垺銇勯幇顖毿撻柟渚垮妼椤粓宕卞Δ鈧獮濠勭磽閸屾艾鈧懓顫濋妸鈺佺疅缂佸顑欓崥瀣煕椤愵偅绶氱紓鍐╂礋濮婂宕掑▎鎴М濠电姭鍋撻梺顒€绉甸幆鐐哄箹濞n剙濡肩紒鎰殜閺屸€愁吋鎼粹€茬敖婵炴垶鎸哥粔鐢稿Φ閸曨垰鍐€妞ゆ劦婢€濞岊亪姊虹紒妯诲蔼闁稿海鏁诲濠氭晲婢跺﹤宓嗛梺缁樺姈缁佹挳宕戦幘璇叉嵍妞ゆ挻绋戞禍鐐叏濡厧浜鹃悗姘炬嫹  闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁炬儳缍婇弻锝夊箣閿濆憛鎾绘煕閵堝懎顏柡灞诲€濆畷顐﹀Ψ閿旇姤鐦庡┑鐐差嚟婵潧顫濋妸褎顫曢柟鎹愵嚙绾惧吋绻涢崱妯虹瑨闁告﹫绱曠槐鎾寸瑹閸パ勭彯闂佹悶鍔岄悥鍏间繆閹绢喖绀冩い鏃傚帶缁愭盯姊洪崫鍕垫Ч闁搞劌缍婂畷銏犆洪鍛偓鍨殽閻愯尙浠㈤柛鏃€纰嶉妵鍕晜鐠囪尙浠搁悗瑙勬穿缁绘繈鐛惔銊﹀殟闁靛/鍐ㄥ闂傚倸饪撮崑鍕洪敃鈧叅闁哄秲鍔庢晶锟犳⒒閸屾瑦绁版い鏇嗗應鍋撻崹顐㈡诞鐎规洘绮撻幃銏$附婢跺绋侀梻浣瑰劤缁绘劕锕㈡潏鈺侇棜闁稿繘妫跨换鍡樸亜閺嶃劎顣查柟顖氱墛閵囧嫰顢曢姀鈶裤垺銇勯鍕殻濠碘€崇埣瀹曞崬螖閳ь剟锝炴惔銊︹拺闁告稑饪撮悞濂告煕閵夋垵鎳庡銊モ攽閻橆喖鐏辨繛澶嬬閻у矂姊虹紒妯荤叆闁告艾顑夐幃锟犲Ψ閳哄倸鈧敻鏌ㄥ┑鍡涱€楅柛妯绘尦閺屾稓鈧綆鍋呯亸鎵磼缂佹ḿ绠撴い顐g箞椤㈡ê鈽夊▎蹇d紪闂備浇宕甸崰鎰垝鎼淬垺娅犳俊銈呭暞閺嗘粓鏌熼悜妯诲暗妞も晜褰冮湁闁绘挸娴烽幗鐘绘煟閹惧瓨绀嬮柡宀€鍠栭獮鍡氼檨闁搞倗鍠栭弻宥夋寠婢舵ɑ鈻堥梺鍝勮嫰缁夊墎妲愰幒鎳崇喖鎳¢妶鍛辈濠碉紕鍋戦崐銈夊磻閸涱垱宕查柛顐犲劚缁犵姵绻濇繝鍌涘櫣闁哄鐗婃穱濠囶敍濠垫劕娈銈呯箰缂嶅﹤顫忔繝姘<婵炲棙鍩堝Σ顕€姊虹涵鍜佸殝缂佽鲸娲滈崚鎺戔枎閹惧磭顓洪梺鎸庢煥閹碱偅绂嶆總鍛娾拺闁告繂瀚峰Σ褰掓煕閵娧冩灈鐎殿喗鎮傚顕€宕奸悢鍝勫箰闂備礁鎲¢崝褏寰婇懞銉ь洸闁告挆鍛紳婵炶揪缍€濞咃絿鏁☉姘辩<閻庯綆鍋呯亸鎵磼閸屾稑娴柡浣稿暣瀹曟帒顫濋幉瀣簥濠电姵顔栭崰妤呮晝閳哄懎绀堥柨鏇炲€归崐鐢告煙閹澘袚闁抽攱甯掗湁闁挎繂鎳忛幉鎼佹煥濞戞ḿ肖缂佽鲸甯¢、姘跺川椤撶姳妗撴俊銈囧Х閸嬬偤宕归崹顔炬殾闁割偅娲﹂弫鍡涙煕鐏炵偓鐨戦柕鍫畵濮婅櫣鎷犻幓鎺戞瘣缂傚倸绉村Λ娆戠矉瀹ュ鍐€妞ゆ挾鍋熼崫妤佺箾鐎电ǹ孝妞ゆ垵妫濋幃鈥斥枎閹剧补鎷哄銈嗘尪閸斿酣鎮鹃崡鐑嗙唵鐟滄粓宕归柆宥呂﹂柛鏇ㄥ灠濡﹢鏌涢…鎴濇灀闁稿鎸鹃幉鎾礋椤撴稒鏁靛┑鐘垫暩婵潙煤閿曞倸纾归梺鍨儍娴滄粓鐓崶銊﹀碍妞ゅ繈鍊濋弻娑氣偓锝庡亝瀹曞瞼鈧鍠栭埀顒傚櫏濡俱劌鈹戦悙鎻掓倯闁绘娲熼崺鐐哄箣閿旇棄浜归柣搴℃贡婵挳藟濠靛鈷戠紒瀣劵椤箓鏌涢弬鍧楀弰妤犵偛顦~銏犵暆閳ь剟鎮块埀顒€鈹戦悙鏉戠仸瀹€锝呮健閹潡宕ㄧ€涙ǚ鎷洪梺闈╁瘜閸欌偓婵$偓鎮傞弻娑㈡偐閹颁焦鐤侀悗娈垮枟閻擄繝鐛弽銊﹀闁革富鍘煎鎶芥⒒娴h櫣甯涙繛鍙夌墵瀹曟劙宕烽娑樹壕婵ḿ鍋撶€氾拷
核心提示:Download board.zip - 39.6 KB - Old VersionDownload board_2008.zip - 55.03 KB- Latest VS 2008 Version IntroductionThis is an Ajax based WhiteBoard application. T
Download board.zip - 39.6 KB - Old Version 
Download board_2008.zip - 55.03 KB - Latest VS 2008 Version
Introduction 
This is an Ajax based WhiteBoard application. Typically unlike their desktop based counterparts, web applications need to be designed to use optimal server resources. This is one of the reasons for AJAX being popular. Here I demonstrate a powerful use of AJAX to make communication possible between two or more clients.



So, What can this do?
As I said, this is a WhiteBoard Application. Users are PRovided with certain drawing tools, color selections, etc. The basic idea is to share the user drawings among all the clients. All the users viewing the main page can participate in the drawing and share it with all other users. Clearing local canvas, server data, etc is also possible.

Background
A couple of years ago I was assigned the task of researching the capabilities of AJAX. Being a tech freak I was hell bent on convincing the client to use the then NEW AND HOT technology. I wasted a few days thinking on my right approach to the design and GUI. I wanted the application to look something like a desktop application and yet be executed in a browser. My aim was to avoid postbacks completely.(To impress the client). I was scampering through every result on google, reading every article on AJAX so as to get the perfect Application as a demo.

I happened to see a javascript (wz_jsgraphics.js) by Walter Zorn Link . It was then that the idea of building a web based WhiteBoard struck me. I give full credit to Walter for his Excellent Javascript. Once I learned using his script, it was just a matter of days before my own Web based Whiteboard was up and running.

The Basics...
As in all AJAX based applications, I have a main page that is displayed to the user. A page on the server handles all the requests and responses to this page. All the drawing part is done using Walters javascript. I designed a messaging mechanism to identify the clients request and serve the client accordingly. I have divided the javascript into various files, depending on the functionality. Understanding the application flow is fairly simple.



Notice that at any point the client initiates a request of data. The server only acts as a central place to hold the data (using ArrayList). The client sends a number indicating the start position from where it is requesting the data.

Using the code
You can find a detailed explanation of the graphics library on Walters's website.

I will start with a brief explanation on the contents of every file.

Javascript Files :-

1) ajaxfunctions.js - Contains functions that send and receive data from the server. It also contains javascript functions to update the screen canvas after getting the data from the server. Functions for selection of tools and colors, sending request to clear server data, etc are also placed in this file.

2) ajaxobjects.js - Contains functions to create ajax object and send the xmlHTTP request.

3) common.js - Contains functions I thought would cramp the main page. Mostly 1 - 2 line functions which are used many times.

4) constants.js - Contains all the client side constants used for the application. Classified as Colors, tools , query string , etc.

5) drawing.js - Contains functions that will handle the drawing and also initiate contact with the server.

6) wz_jsgraphics.js - This is ofcourse the most important drawing library without which this application is a stub. It contains all the functions that actually draw the shapes on the client side canvas.

asp.net Files. (Server Side C#) :-

7) Constants.cs - This contains all server side constants.

8) HandleData.aspx - This is the file where all the ajax requests are posted to. It has functions to decide what the client wants and then respond with the users data.

9) index.aspx - This is the main form with all controls. It is just a service user. This page serves as a GUI which initialises the sharing process.

Putting it up all together, this is a simple explanation.

1) User "A" loads the "index.aspx" page on his screen.
2) He selects some tool and some color and starts designing on his screen.
3) One more user, User "B" visits the "index" page.
4) Since "B" is a new user he gets all the data from the server and user A's canvas is replicated on user B's screen.
5) Now AJAX comes into picture. To keep both the users in sysnc, AJAX scripts are running at regular interval.
6) When a user makes any changes in the selected tool, color or draws something on the screen, an AJAX script updates the server.
7) The steps are repeated with any number of users.
8) I think ideally in a LAN/WAN environment 15 users can be easily accomodated.

Lets begin the detailed explanation of some of the important client side functions.

Collapse Copy Code
//Function to set the drawing data on the server
function setData() {

  var requestUrl;

  //Get the url path
  requestUrl = CONST_URL_PATH;
  requestUrl += getToolString();

  xmlhttp = GetXmlHttpObject(setDataHandler);

  xmlHttp_Send_Request(CONST_METHOD_POST, xmlHttp, requestUrl);

}//End of setData


Collapse Copy Code
//Function to get the drawing data from server
function getData() {

  var requestUrl;

  //Get the url path
  requestUrl = CONST_URL_PATH;
  requestUrl += CONST_QUERY_PARAM + CONST_QUERY_PARAM_GETDATA;
  requestUrl += '&' + CONST_QUERY_READ_FROM + getValue('ReadFrom');

  xmlHttp = GetXmlHttpObject(getDataHandler);

  xmlHttp_Send_Request(CONST_METHOD_POST, xmlHttp, requestUrl);

}//End of setData


Collapse Copy Code
//Function to get the query string for the current tool
function getToolString() {

  var strOut;

  strOut = CONST_QUERY_PARAM + CONST_QUERY_PARAM_SETDATA;
  strOut += '&' + CONST_QUERY_ACTION + CurrentTool;
  strOut += '&' + CONST_QUERY_COLOR + CurrentColor;
  strOut += '&' + CONST_QUERY_STROKE + CurrentStroke;
  strOut += '&' + CONST_QUERY_STARTX + StartX;
  strOut += '&' + CONST_QUERY_STARTY + StartY;
  strOut += '&' + CONST_QUERY_EndX + EndX;
  strOut += '&' + CONST_QUERY_EndY + EndY;

  return strOut;

} //End of getToolString
The "setData" function calls the "getToolString" function before contacting the server. The "getToolString" function constructs a string in the required format to be sent to the server. Then the "setData" function brings the AJAX object into use and sends a string of data to the server.
The "getData" function creates a request string and requests data from the server, again using AJAX objects.

Notice that in both the functions the callback datahandler is different.(Datahandler is a function that decides what to do with the data returned from the server)

Collapse Copy Code
//Function to handle the callback for the set data ajax function
//THIS HANDLER IS USED FOR TWO AJAX FUNCTIONS
function setDataHandler() {

  //readyState of 4 or 'complete' represents that data has been returned
  //Check the state of the page
  if (xmlHttp.readyState == CONST_INT_READY_STATE || xmlHttp.readyState == CONST_READY_STATE){

  //Get the response text
  var strText = xmlHttp.responseText;

    //Check if error occured
   if (strText.indexOf(CONST_ERROR) >= 0) {
    //Error occured
    errHandler(strText.split(CONST_INTERNAL_SEPERATOR)[1]);

   } else {

    //Reset the status bar text msg for success
    errHandler(CONST_MSG_DATASET);

    //Change the value in the hidden so that next
    //read starts after the
    //current value
    setValue('ReadFrom', parseInt(getValue('ReadFrom')) + 1);

   }//End of checking if error occured

  //Toggle the waiting div
  toggleLoading(false);

  } //End of checking if the script is over

} //setDataHandler

The "setDataHandler" function first checks if the browser is in ready state. Then it reads the returned ResponseText from the AJAX object, checks for any errors and then resets the status bar message accordingly. At the end it also sets the current instruction number that it has received from the server.

Collapse Copy Code
//Function to handle the call back of the get data ajax function
function getDataHandler() {

  //readyState of 4 or 'complete' represents that data has been returned
  //Check the state of the page
  if (xmlHttp.readyState == CONST_INT_READY_STATE || xmlHttp.readyState == CONST_READY_STATE){

  //Get the response text
  var strText = xmlHttp.responseText;

   //Check if error occured
   if (strText.indexOf(CONST_ERROR) >= 0) {
    //Error occured
    errHandler(strText.split(CONST_INTERNAL_SEPERATOR)[1]);

   } else {

    //Reset the status bar text msg for success
    errHandler(CONST_MSG_DATAGET);

    //Update the screen
    var iNum = updateScreen(strText);

    //Change the value in the hidden so that next
    //read starts after the set value
    setValue('ReadFrom', parseInt(getValue('ReadFrom')) + iNum);

   }//End of checking if error occured

  //Toggle the waiting div
  toggleLoading(false);

  //Set a call to the same function again after the specified time interval
  window.setTimeout('getData()', CONST_DATA_TIMEOUT);

  } //End of chekcing if the script is over

} //End of getDataHandler

The "getDataHandler" function also checks if the browser is in ready state. Then it reads the returned ResponseText from the AJAX object, checks for any errors and then resets the status bar message accordingly. Unlike the "setDataHandler" function, this function first updates the screen (updateScreen function call) and then sets the current instruction number.

Collapse Copy Code
//function that will handle the data that is received from the getData function
function updateScreen(strText) {
  //Split the text into lines
  var strLines = strText.split(CONST_LINE_SEPERATOR);
  var i;
  //Check the length of the lines
  if (strLines.length > 0) {
   //Loop on the no of lines
   for (i = 0; i < strLines.length; i++) {
    //Get the individual properties by splitting each string
    var strMainText = strLines[i].split(CONST_INTERNAL_SEPERATOR);

    //Check if CLEAR IS CALLED
    if (strMainText[0] == CONST_ACTION_TOOL_CLEAR) {

     //CLEAR THE CANVAS
     clearCanvas();

    } else {

     //Set all the variables before calling the draw function
     setTool(strMainText[0]);
     setColor(strMainText[1]);
     setStroke(parseInt(strMainText[2]));
     setStart(parseInt(strMainText[3]), parseInt(strMainText[4]));
     setEnd(parseInt(strMainText[5]), parseInt(strMainText[6]));

     //Now call the draw function
     drawPic();

    } //End of checking the call for CLEAR

   } //End of looping on the no of lines

   //Return the count so the next search starts after this number
   return i;

  } //End of checking the no of lines

  return 0;

} //End of updateScreen

The "updateScreen" function splits the received text based on the predefined special characters. The first split is actually the split of instructions. The second split is the inter instruction split (to get the tool, color, start and end, etc) After breaking the data it draws the required image on screen.(call to drawPic function) Now, let us have a look at the server side. The server side is handled by the "HandleData.aspx" page load event. Depending on the request the "getData" or "setData" functions are called.

Collapse Copy Code
//Function to get the data and set it to the page
private void getData()
{
  string strReadFrom = Request.QueryString.Get(Constants.CONST_QUERY_READ_FROM);
  //Check the read value
  if (strReadFrom != null && strReadFrom.Length > 0)
  {
   StringBuilder strText = new StringBuilder("");
   int iFrom = Int32.Parse(strReadFrom);
   //Get the array list from the application object
   ArrayList arrData = (ArrayList)Application[Constants.CONST_APP_DATA_ARRAY_NAME];

   //Check if ifrom is equal to the length of the arraylist
   //Means no new data to read
   if (iFrom >= arrData.Count)
    {
    //Screen is already updated
    //Write the error with the first Word set to identify as error
    Response.Write(Constants.CONST_ERROR +
      Constants.CONST_INTERNAL_SEPERATOR +   
      Constants.CONST_ERROR_ALREADY_UPDATED);

    return;

   } //End of checking the length

   //Add the first element
   strText.Append(arrData[iFrom]);

   //Do the process to create a response string
   for (int i = iFrom + 1; i < arrData.Count; i++)
   {
    strText.Append(Constants.CONST_LINE_SEPERATOR + arrData[i]);

   } //End of appending the data to the string builder

   //Write the string builder to the page
   Response.Write(strText.ToString());
  }
  else
  {
   //Write the error with the first word set to identify as error
   Response.Write(Constants.CONST_ERROR +
    Constants.CONST_INTERNAL_SEPERATOR +
    Constants.CONST_ERROR_PARAM);

  }//End of checking the read value

} //End of getData

This "getData" function first reads the COUNTER from where the client is requesting data. It then loops on the serverside ArrayList that stores the instructions. Here it also checks for existence of new data. In case new data exists, only then the output string is created and then returned using the "Response.Write" statement. (This is the string that is returned to the calling AJAX function).

Collapse Copy Code
//Function to set the data on the server
private void setData()
{
  //Get the array list from the application object
  ArrayList arrData = (ArrayList)Application
    [Constants.CONST_APP_DATA_ARRAY_NAME];

  //Get all the drawing values from the request querstring
  string strAction = Request.QueryString.Get(Constants.CONST_QUERY_ACTION);
  string strColor = Request.QueryString.Get(Constants.CONST_QUERY_COLOR);
  string strStroke = Request.QueryString.Get(Constants.CONST_QUERY_STROKE);
  string strStartX = Request.QueryString.Get(Constants.CONST_QUERY_STARTX);
  string strStartY = Request.QueryString.Get(Constants.CONST_QUERY_STARTY);
  string strEndX = Request.QueryString.Get(Constants.CONST_QUERY_ENDX);
  string strEndY = Request.QueryString.Get(Constants.CONST_QUERY_ENDY);

  if (strAction != null && strAction.Length > 0)
  {
   if (strAction.Equals(Constants.CONST_ACTION_TOOL_CLEAR))
   {
    arrData.Add(strAction + Constants.CONST_INTERNAL_SEPERATOR);
   }
   else
   {
    //Check if all are present
    if (strColor != null && strStroke != null &&
     strStartX != null && strStartY != null &&
     strEndX != null && strEndY != null &&
     strColor.Length > 0 && strStroke.Length > 0 &&
     strStartX.Length > 0 && strStartY.Length > 0 &&
     strEndX.Length > 0 && strEndY.Length > 0)
    {
     //Set the data in the application array
     arrData.Add(strAction + Constants.CONST_INTERNAL_SEPERATOR +
     strColor + Constants.CONST_INTERNAL_SEPERATOR +
     strStroke + Constants.CONST_INTERNAL_SEPERATOR +
     strStartX + Constants.CONST_INTERNAL_SEPERATOR +
     strStartY + Constants.CONST_INTERNAL_SEPERATOR +
     strEndX + Constants.CONST_INTERNAL_SEPERATOR +
     strEndY);

     //Write a blank string as an identification that no error occured
     Response.Write("");
    }
    else
    {
     //Write the error with the first word set to identify as error
     Response.Write(Constants.CONST_ERROR +
      Constants.CONST_INTERNAL_SEPERATOR +
      Constants.CONST_ERROR_PARAM);

    }//End of Checking if all querystrings are valid
   }

  }
  else
  {
   //Write the error with the first word set to identify as error
   Response.Write(Constants.CONST_ERROR +
    Constants.CONST_INTERNAL_SEPERATOR +
    Constants.CONST_ERROR_PARAM);
  }//Check if the action is not null

} //End of setData

The "setData" function does exactly the opposite task. It gets all the parameters from the request and makes a string out of it. It then adds the string to the serverside ArrayList. In case of errors it writes the error using the "Response.Write" statement. Other places of concern are the function calls that are set on the "index.aspx" page. You can easily add new colors and new functionality. Just add the relevant constants and incorporate the required functions. The messaging architecture remains the same.

Points of Interest
A simple messaging architecture can be used to linkup many computers. When the application is running it seems to be a very huge task. Since we are doing bulk of the task on the client side the user experience is also great. 

Tags:AJAX 实现 多人

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接