锘??xml version="1.0" encoding="utf-8" standalone="yes"?>老司机亚洲精品影院在线观看,亚洲国产精品久久久久秋霞影院 ,亚洲综合一区二区国产精品http://www.tkk7.com/javaora/category/6993.htmlzh-cnTue, 27 Feb 2007 14:48:29 GMTTue, 27 Feb 2007 14:48:29 GMT60Framework 涓嶭ibrary 鍜孴ookit鐨勫尯鍒?/title><link>http://www.tkk7.com/javaora/archive/2006/05/05/44623.html</link><dc:creator>java涓栫晫鐣呰皥</dc:creator><author>java涓栫晫鐣呰皥</author><pubDate>Fri, 05 May 2006 05:22:00 GMT</pubDate><guid>http://www.tkk7.com/javaora/archive/2006/05/05/44623.html</guid><wfw:comment>http://www.tkk7.com/javaora/comments/44623.html</wfw:comment><comments>http://www.tkk7.com/javaora/archive/2006/05/05/44623.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/javaora/comments/commentRss/44623.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/javaora/services/trackbacks/44623.html</trackback:ping><description><![CDATA[ <h2>Framework錛堟鏋訛級</h2> <p>In software development, a framework is a defined support structure in which other project can be organized and developed. A framework typically consists of several smaller components; support programs, libraries, and a scripting language. There may also be other software involved to aid in development and meshing of the different components of a project. As you can see, dojo could be part of a framework, but it isn't a framework in itself.<br /></p> <p>鍦ㄨ蔣浠跺紑鍙戜腑錛屼竴涓鏋舵槸涓涓瀹氫箟鐨勬敮鎸佺粨鏋勶紝鍦ㄥ叾涓叾浠栭」鐩彲浠ヨ緇勭粐鍜屽紑鍙戙備竴涓鏋朵唬琛ㄦу湴鍖呭惈闇瑕佸皬鐨勭粍浠躲佹敮鎸佺▼搴忋佺被搴撱佸拰涓涓剼鏈? 璇█銆傝繖浜涗篃鍙兘鏄叾浠栬蔣浠跺寘鎷府鍔╁紑鍙戝拰涓嶅悓鐨勯」鐩粍浠剁紪鍒躲傚浣犵湅鍒扮殑錛宒ojo鍙兘鏄鏋剁殑涓閮ㄥ垎錛屼絾鏄湰璐ㄤ笂瀹冩湰韜笉鏄竴涓鏋躲?br /></p> <h2>Library錛堝簱錛?/h2> <p>A library is defined as a collection of related functions and subroutines used to develop software. They are distinguished from executables in that they are not independant programs; rather, they are "helper" code that provide access to common functions in one easy to manage location. After reading this you are probably saying, "Hey! dojo is a collection of libraries!", and you would be correct; however, dojo is much more than just a collection of libraries.<br /> 搴撹瀹氫箟涓轟竴涓浉鍏沖姛鑳藉拰琚敤鏉ュ紑鍙戣蔣浠剁殑瀛愮▼搴忕殑闆嗗悎銆備粬浠尯鍒簬鎵ц錛屽湪鍏朵腑浠栦滑涓嶆槸鐙珛鐨勭▼搴忥紱鏇撮傚悎鐨勶紝浠栦滑鏄滃姪鎵嬧濅唬鐮侊紝鐢ㄦ潵鏀寔閫氳繃閫氱敤 鎴愪負(fù)涓浣撶殑鍔熻兘瀹規(guī)槗鏉ヨ繘琛岀鐞嗐傚湪璇誨畬榪欎簺錛屼綘鍙兘璇達(dá)紝鈥滃棬錛乨ojo鏄竴涓簱鐨勯泦鍚堚濓紝浣犲彲鑳芥槸姝g‘鐨勶紝鐒惰岋紝dojo涓嶄粎浠呮槸鍋氫負(fù)涓涓簱鐨勯泦鍚堛?br /></p> <h2>Toolkit錛堝伐鍏鳳級</h2> <p>Now on to toolkits. A toolkit is generally used in reference to graphical user interface (GUI) toolkits. Basically, a library that is mainly focused on creating a GUI. Yes, dojo could also fall under this category, in fact our name implies it. Why do we call dojo a toolkit? Certainly not because it focuses mainly on GUI development, right? Well quite simply, because dojo is so much more than just a collection of libraries.<br /></p> <p>鐜板湪璇磋toolkits. 涓涓伐鍏烽氬父琚敤鍦ㄥ弬鑰冨浘褰㈢敤鎴風(fēng)晫闈㈠伐鍏楓傚熀紜鍦幫紝涓涓被搴撲富瑕侀泦涓湪鍒涘緩涓涓狦UI銆傛槸鍦幫紝dojo鍙褰掑叆榪欎釜綾誨埆錛屽疄闄呬笂鎴戜滑鍛藉悕鏆楃ず浜嗗畠錛屼負(fù)浠涔? 鎴戜滑鍙玠ojo鏄竴涓伐鍏鳳紵褰撶劧涓嶆槸鍥犱負(fù)瀹冧富瑕侀泦涓湪GUI寮鍙戯紝姝g‘涔堬紵寰堝ソ錛屽叾瀹炲緢綆鍗曪紝鍥犱負(fù)pojo涓嶄粎浠呮槸涓涓簱鐨勯泦鍚堛?br /></p> <img src ="http://www.tkk7.com/javaora/aggbug/44623.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/javaora/" target="_blank">java涓栫晫鐣呰皥</a> 2006-05-05 13:22 <a href="http://www.tkk7.com/javaora/archive/2006/05/05/44623.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>What is dojo 浠涔堟槸Dojohttp://www.tkk7.com/javaora/archive/2006/05/05/44594.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Fri, 05 May 2006 03:29:00 GMThttp://www.tkk7.com/javaora/archive/2006/05/05/44594.htmlhttp://www.tkk7.com/javaora/comments/44594.htmlhttp://www.tkk7.com/javaora/archive/2006/05/05/44594.html#Feedback0http://www.tkk7.com/javaora/comments/commentRss/44594.htmlhttp://www.tkk7.com/javaora/services/trackbacks/44594.html Dojo is an Open Source DHTML toolkit written in JavaScript. It builds on several contributed code bases (nWidgets, Burstlib, f(m)), which is why we refer to it sometimes as a "unified" toolkit. Dojo aims to solve some long-standing historical problems with DHTML which prevented mass adoption of dynamic web application development.

聽聽聽 Dojo鏄竴涓嬌鐢↗avascript緙栧啓鐨勫紑婧怐HTML宸ュ叿銆傚畠寤虹珛浜庡緢澶氬凡鎹愮尞鐨勪唬鐮佸熀紜錛坣Widgets銆丅urstlib銆乫(m)錛?榪? 鏄負(fù)浠涔堟垜浠皥鍒板畠鏈夋椂鏄竴涓?緇熶竴"鐨勫伐鍏楓侱ojo鑷村姏浜庤В鍐充竴浜涢暱鏈熷瓨鍦ㄧ殑浼撮殢DHTML鐨勫巻鍙查棶棰橈紝瓚熼樆姝㈠ぇ澶氭暟閲囩敤鍔ㄦ亀eb搴旂敤紼嬪簭寮鍙戙?br />

Dojo allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript sanely. You can use the components that Dojo provides to make your web sites more useable, responsive, and functional聽 With Dojo you can build degradeable user interfaces more easily, prototype interactive widgets quickly, and animate transitions.聽 You can use the lower-level APIs and compatibility layers from Dojo to write portable JavaScript and simplify complex scripts. Dojo's event system, I/O APIs, and generic language enhancement form the basis of a powerful programming environment. You can use the Dojo build tools to write command-line unit-tests for your JavaScript code.聽 You can use the Dojo package system to make your code easier to maintain and less platform dependent.聽 The Dojo build process helps you optimize your JavaScript for deployment by grouping sets of files together and reuse those groups through "profiles".

Dojo鍏佽浣犲鏄撳湴寤虹珛鍔ㄦ佹ц兘鍒皐eb欏甸潰鍜屽叾浠栫ǔ鍋ユ敮鎸乯avascript鍦扮幆澧冧腑銆?浣犲彲浠ヤ嬌鐢―ojo鏀寔緇勪歡錛屽畠浣夸綘鐨剋eb绔欑偣鏇存湁鍙敤琛岀殑銆備即闅廳ojo,浣犲彲浠ユ洿瀹規(guī)槗鍦板緩绔媎egradeable鐢ㄦ埛鐣岄潰錛岃繀閫熷湴鍘熷瀷浜や簰楗頒歡鍜屽姩鐢昏漿鍙樸備綘鍙互浣跨敤搴曞眰鍦癮pi鍜屽吋瀹瑰眰錛屼粠Dojo鍒板啓杞諱究鐨凧avascript鍜岀畝鍗曞鏉傛暀鏈侱ojo鐨勪簨浠剁郴緇燂紝I/O api,鍜屾硾鍨嬭璦澧炲己緇勬垚寮哄ぇ鐨勭▼搴忕幆澧冪殑鍩虹銆?浣犲彲浠ヤ嬌鐢╠ojo寤洪犲伐鍏鋒潵涓轟綘鐨凧avascript浠g爜鍐欏懡浠よ鍗曞厓嫻嬭瘯銆備綘鍙互浣跨敤Dojo 鍖呯郴緇熸潵浣垮緱浣犵殑浠g爜鏇村鏄撳幓緇存姢鍜屾洿灝戝鉤鍙頒緷璧栥?Dojo寤洪犺繃紼嬪府鍔╀綘浼樺寲浣犵殑Javascript涓轟綘鐨勯儴緗詫紝瀹冮氳繃涓璧峰垎緇勬枃浠墮泦鍚堝拰閫氳繃"profile"閲嶇敤榪欎簺緇勩?

Dojo does all of these things by layering capabilities onto a very small core which provides the package system and little else. When you write scripts with Dojo, you can include as little or as much of the available APIs as you need to suit your needs. Dojo provides MultiplePointsOfEntry, InterpreterIndependence, ForwardLookingAPIs, and focuses on ReducingBarriersToAdoption.

Dojo澶勭悊鎵鏈夎繖浜涗簨鎯咃紝閫氳繃鍒嗗眰鑳藉姏鍒嗚В鎴愪竴浜涢潪甯稿皬鐨勫拰鏍稿績錛屽畠鏀寔鍖呯郴緇熷拰鍏朵粬鏇村皯鐨勩傚崟浣犲啓鏄嬌鐢―ojo鍐欒剼鏈紝浣犲彲浠ュ寘鍚綔涓哄緢灝戞垨 鑰呭悓鏍峰鍙敤鐨刟pi浣滀負(fù)浣犻渶瑕佹弧瓚充綘鐨勯渶瑕佺殑銆侱ojo鏀寔MutiplePointsOfEntry, InterprerterIndependence, ForwardLookingAPIs, 鍜岄泦涓璕educingBarriersToAdoption.

Dojo is being built around a single markup language that will provide application authors with a (more) simple way of declaring and using responsive DHTML interface components. Renderings may be made available in several rendering contexts (such as SVG, or perhaps even the desktop or Flash), but the markup language (DojoML) and scripting language (JavaScript) will not change. Better yet, the DojoML parser accepts extended HTML and SVG as valid input, and can be used to easily create DegradeableResponsiveApplications.

Dojo鏄竴涓寤洪犲湪涓涓崟涓鐨勬爣璁拌璦錛屽畠?yōu)畣鏀寔搴旂敤绋嬪簭浣滆呴噰鐢ㄤ竴涓紙澶氫釜錛夌畝鍗曟柟娉曟潵澹版槑鍜屼嬌鐢ㄤ綔鍑哄搷搴旂殑DHTML鐣岄潰緇勪歡銆傝〃鐜板湪璁稿琛ㄧ幇涓婁笅鏂?渚? 濡傦細(xì)SVG錛屾垨鐢氳嚦鍙兘妗岄潰鎴杅lash)鍙兘琚悎娉曞寲,浣嗘槸鏍囪璇█(DojoML)鍜岃剼鏈璦錛圝avascript錛夊皢涓嶆敼鍙樸傜劧鑰屾洿濂界殑錛? DojoML 瑙f瀽鍣ㄦ帴鍙楀凡鎵╁睍鐨凥TML鍜孲VG浣滀負(fù)涓涓悎娉曠殑杈撳叆錛屽茍涓斿彲浠ヨ瀹規(guī)槗鐨勫垱寤篋egradeableResponsiveApplications.



]]>
MyEC 4.1鏂板鐨勫嚑涓姛鑳?/title><link>http://www.tkk7.com/javaora/archive/2006/04/19/42016.html</link><dc:creator>java涓栫晫鐣呰皥</dc:creator><author>java涓栫晫鐣呰皥</author><pubDate>Wed, 19 Apr 2006 14:35:00 GMT</pubDate><guid>http://www.tkk7.com/javaora/archive/2006/04/19/42016.html</guid><wfw:comment>http://www.tkk7.com/javaora/comments/42016.html</wfw:comment><comments>http://www.tkk7.com/javaora/archive/2006/04/19/42016.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/javaora/comments/commentRss/42016.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/javaora/services/trackbacks/42016.html</trackback:ping><description><![CDATA[1.澧炲姞浜嗕竴涓浘褰㈢紪杈戝櫒銆傚懙鍛碉綖锝烇紝浠ュ悗綆鍗曠殑涓滆タ錛屽湪Eclipse涓氨鍙互緙栬緫浜嗭紒<br />2.Spring鍜孒ibernate鐨勮嚜鍔ㄩ泦鎴?br />3.Jsp Editor錛屽叾瀹炶繖涓笢瑗匡紝鎴戜滑涓鑸槸涓嶅仛浣跨敤鐨勩備互鍓嶇殑鐗堟湰鍑虹幇鐨勭粡甯告ф墦寮寰堟參鐨勬儏鍐點?br />4.UML鍥懼艦<br />5.Javascript<img src ="http://www.tkk7.com/javaora/aggbug/42016.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/javaora/" target="_blank">java涓栫晫鐣呰皥</a> 2006-04-19 22:35 <a href="http://www.tkk7.com/javaora/archive/2006/04/19/42016.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>MyEclipse JavaScript Debugger (MyEclipse javascript 璋冭瘯鍣?http://www.tkk7.com/javaora/archive/2006/04/19/42014.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Wed, 19 Apr 2006 14:24:00 GMThttp://www.tkk7.com/javaora/archive/2006/04/19/42014.htmlhttp://www.tkk7.com/javaora/comments/42014.htmlhttp://www.tkk7.com/javaora/archive/2006/04/19/42014.html#Feedback0http://www.tkk7.com/javaora/comments/commentRss/42014.htmlhttp://www.tkk7.com/javaora/services/trackbacks/42014.htmlThe MyEclipse JavaScript Debugger is聽the first聽fully integrated聽client-side Eclipse debugger for JavaScript. Feature highlights include:
MyEc Javascript 璋冭瘯鍣ㄨ瘯棣栦釜涓篔avascript銆傚畬鏁撮泦鎴愬鎴風(fēng)Eclipse璋冭瘯鍣ㄣ傜壒寰佷富瑕佸寘鍚細(xì)

  • Debug any web page containing JavaScript source or included JavaScript files, or standalone JavaScript files
  • 璋冭瘯浠諱綍web欏甸潰鍖呭惈Javascript 婧愪唬鐮佹垨鍖呭惈Javascript 鏂囦歡錛屾垨鑰呭崟鐙殑Javascript鏂囦歡
  • Operations: Pause, Resume, Step Into, Step Over, Step to Return, Terminate
  • 鎿嶄綔錛氭殏鍋溿侀噸鏂板紑濮嬨佽繘鍏ャ佽煩鍑恒佽煩鍏ヨ繑鍥炪佺粓姝?
  • Views: 瑙嗗浘
    • Web Browser View (web 嫻忚鍣ㄨ鍥?
    • Call Stack View聽 錛堝懠鍙爢鏍堣鍥撅級
    • Variables View (鍙橀噺瑙嗗浘)
    • Console View聽 錛堟帶鍒跺彴瑙嗗浘錛?/li>
  • Set JavaScript breakpoints in: 璁劇疆javascript鏂偣
    • JavaScript聽files (Javascript鏂囦歡)
    • HTML with embedded JavaScript and linked JavaScript files 錛堝寘鍚唴緗殑javascript鍜屽叧鑱旂殑javascript鏂囦歡鐨凥TML錛?
    • JSP聽files (jsp 鏂囦歡)
    • Conditional breakpoints planned for MyEclipse 4.1.1 錛堜負(fù)MyEC鐨勬湁鏉′歡鐨勬柇鐐硅鍒掞級
  • Integrates with Eclipse Launch Manager 錛堥泦鎴怑clipse鍙戣綆$悊鍣級
    • Quick launch from context-menu using "Debug As" (浣跨敤Debug As 榪呴熻皟鐢ㄤ笂涓嬫枃鎸夐挳)
    • Launch from Eclipse Debug toolbar action 錛堜粠Eclipse 璋冭瘯宸ュ叿鏉¤涓轟腑璋冪敤錛?
    • Use Launch Profile to modify launch configuration 錛堬級
    • Launch JavaScript resource from project location or deployed MyEclipse web-application


]]>
10鏉¢氬悜蹇焀eb 绔欑偣鐜板疄鐨勬楠?/title><link>http://www.tkk7.com/javaora/archive/2006/02/11/30257.html</link><dc:creator>java涓栫晫鐣呰皥</dc:creator><author>java涓栫晫鐣呰皥</author><pubDate>Sat, 11 Feb 2006 05:48:00 GMT</pubDate><guid>http://www.tkk7.com/javaora/archive/2006/02/11/30257.html</guid><wfw:comment>http://www.tkk7.com/javaora/comments/30257.html</wfw:comment><comments>http://www.tkk7.com/javaora/archive/2006/02/11/30257.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/javaora/comments/commentRss/30257.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/javaora/services/trackbacks/30257.html</trackback:ping><description><![CDATA[10鏉¢氬悜蹇焀eb 绔欑偣鐜板疄鐨勬楠?BR>1.紜畾鐡墮<BR> 1.1鏂囦歡澶у皬<BR>   鍦ㄩ渶瑕佷嬌鐢ㄨ繖涓〉闈㈡椂鐢ㄦ埛闇瑕佸姞杞藉灝戞暟鎹傘?BR>   60-100K 欏甸潰澶у皬 淇濇寔鏁欏皬鐨勬枃浠?BR> 1.2鍙嶅簲鏃墮棿<BR>   浣犲悜鏈嶅姟鍣ㄥ彂閫佽姹傚拰鏁版嵁鍒拌揪PC鐨勬椂闂撮棿闅?BR>   緗戠粶鍙嶅簲鏃墮棿<BR>2.鍑忓皯鏂囦歡澶у皬<BR>  100K浠ヤ笂 <BR>  澶ч噺鐨勬枃浠跺綋鍓嶄富瑕佹槸鐢卞法澶х殑Javascript綾誨簱銆?BR>  宸ㄥぇ鐨勫浘鐗?BR>  鑰佺殑HTML鏍峰紡涔熶細(xì)浜х敓澶ф枃浠訛紝灝藉彲鑳藉湴浣跨敤XHTML鍜孋SS<BR>  鍘嬬緝<BR>3.鏌ユ壘浠涔堝鑷翠簡寰堥珮鐨勫弽搴?BR>  濡備笂鎴戜滑鎵鎻愬埌鐨勶紝鍙嶅簲鏃墮棿涓昏鐢變袱涓富瑕佺殑鍏冪礌<BR>  3.1緗戠粶鍙嶅簲鏃墮棿<BR>  3.2鏄惁鑺辮垂浜嗗お闀跨殑鏃墮棿鏉ヤ駭鐢熼〉闈?BR>  3.3鎬ц兘<BR>4.紜畾緇濈紭緇勪歡<BR>5.緙栬瘧緙撳瓨<BR>6.鏌ョ湅DB鏌ヨ<BR>  閬垮厤join. 鏌ヨ緙撳瓨<BR>7.鍙戦佹紜殑宸蹭慨鏀規(guī)暟鎹?BR>8.鑰冭檻緇勪歡緙撳瓨<BR>9.鍑忓皯鏈嶅姟鍔犺澆<BR>  9.1浣跨敤鐩稿弽鐨勪唬鐞?BR>  9.2閲囩敤杞婚噺綰х殑HTTP鏈嶅姟鍣?BR>10. 澧炲姞鏈嶅姟鍣?BR><img src ="http://www.tkk7.com/javaora/aggbug/30257.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/javaora/" target="_blank">java涓栫晫鐣呰皥</a> 2006-02-11 13:48 <a href="http://www.tkk7.com/javaora/archive/2006/02/11/30257.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Ten good practices for writing JavaScript in 2005http://www.tkk7.com/javaora/archive/2006/02/08/29976.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Wed, 08 Feb 2006 15:06:00 GMThttp://www.tkk7.com/javaora/archive/2006/02/08/29976.htmlhttp://www.tkk7.com/javaora/comments/29976.htmlhttp://www.tkk7.com/javaora/archive/2006/02/08/29976.html#Feedback0http://www.tkk7.com/javaora/comments/commentRss/29976.htmlhttp://www.tkk7.com/javaora/services/trackbacks/29976.html鍘熸枃鍦板潃錛?A >http://www.bobbyvandersluis.com/articles/goodpractices.php

Ten good practices for writing JavaScript in 2005

1. Make sure your JavaScript code is in balance with its environment

Web Standards are a three-legged stool, or without metaphors(鏆楀柣), a threesome錛堜笁浜轟竴緇勶級 of technologies that should live together in harmony錛堝拰鐫︾浉澶勶級. (X)HTML adds structure and semantics to your content, CSS is responsible for 錛堜負(fù)...璐熻矗錛塱ts presentation, and the DOM provides an interface to add behavior. You keep your Web pages flexible (or: easier to understand, maintain, restyle<鏀瑰彉鏍峰紡> and update behavior) by separating all three layers; structure and content from presentation, structure and content from behavior and presentation from behavior. To accomplish this, try to avoid inline behavior and use unobtrusive techniques instead.

涓昏琛ㄨ堪浜嗕笁縐嶆妧鏈殑緇煎悎浣跨敤錛宧tml涓虹粏鑺傜粨鏋勫拰璇硶 css涓鴻〃鐜拌礋璐?nbsp; dom鏀寔澧炲姞浜嬩歡琛屼負(fù)鐨勬帴鍙c?/P>

When you attach behavior on page load, you may have to work around some known issues. First, you may encounter differences in cross-browser event handling. Second, make sure you don't overwrite existing onload handlers. Last, but not least, you may encounter a delay in the attachment of your behavior. The underlying 錛堟綔鍦ㄧ殑錛塸roblem is that a window onload event will only execute after the whole document, including all page assets like images and objects, is loaded. If your script needs to respond immediately after an element has loaded or if you work with a lot of content, a series of images or a slow server, you may be forced to look for a solution. You can either hide your content until the behavior is attached or attach the behavior via a script call after your elements are loaded, like at the end of the body element.
浠嬬粛鍦ㄩ〉闈㈠紑鍙戜腑涓昏閬囧埌鐨勯棶棰橈紒

Choose your markup wisely, so you can take full advantage of the power of the DOM.<鍏呭垎鍒╃敤dom鐨勫姏閲?gt; For example, when you use nested lists to build a navigation bar, you can use the structure of the DOM tree instead of a replicated(澶嶅埗) structure in arrays.<list dom tree> Scripting should be avoided in some cases where you can use markup or CSS to create behavior. This may sound a bit contradictory(鍙嶅), however built-in behavior enabled by (X)HTML attributes (e.g. disabling a form field or setting a max length on an input field) and CSS pseudo-classes (e.g. when building rollovers or drop downs) are regarded to be wider supported and easier to implement than using JavaScript. ToughQuiz on Quirksmode illustrates the discussion and the fine line between the uses of CSS generated content and regular markup and behavior.

In those cases where CSS currently lacks<緙轟箯> cross-browser support or is missing features for adding presentation, DOM based scripting can supplement<琛ュ厖> CSS. Presentational scripting will probably be replaced in a few years, when browsers have better CSS2.1 compliance<欏轟粠> and with the support of CSS3. Please realize that, because of the interrelationship<鐩鎬簰褰卞搷> of the different Web Standards and because both Web Standards and Web clients are constantly evolving<榪涘寲>, some good practices for using the DOM and JavaScript will change over time<闅忕潃鏃墮棿鐨勮繃鍘?gt;.

2. Create accessible<鍙悊瑙g殑銆佹槗鍙楀獎鍝嶇殑> JavaScript

JavaScript is accessible when a page's navigation, content and main functionality (e.g. submitting a form) is available to your whole target audience, independent of their Web client or input device. This includes:

  • People who use assistive<甯姪> technologies, like screen readers
  • People who don't use a mouse for navigation
  • People who have no JavaScript support (e.g. some mobile clients), have JavaScript disabled, or have partial<閮ㄥ垎鐨?gt; DOM or JavaScript support
  • Machines, like search engines

The most common way to create accessible JavaScript is to use unobtrusive techniques that are mouse independent and enhance your already accessible markup with behavior. Progressive enhancement and its predecessor graceful degradation are good strategies to create Web pages that are accessible to the most common denominator, while providing a better user experience for a smaller group of people with more advanced devices or Web clients. No matter what strategy you use, make sure that you always design for multiple scenarios.

3. Create usable錛堜究浜庝嬌鐢ㄧ殑錛?JavaScript

The usability of a Web page is often determined by a good information architecture, clear and intuitive(鐩磋鐨? visual design and well designed functionality. One of the main arguments to enhance your markup using unobtrusive JavaScript is to improve the usability of a Web page by supporting these usability attributes. If you add JavaScript and don't enhance the usability of a Web page, you should rethink if you should apply it at all.

4. Create easy applicable錛堝彲閫傜敤鐨勶級 JavaScript

Unobtrusive scripting bridges the gap between 'designers' and 'coders'. There is a big group of people in today's industry that does know how to write (X)HTML and CSS but doesn't feel very comfortable with the DOM and JavaScript. Unobtrusive behavior introduced a mechanism to easily apply small portable scripts to a Web page: "Just make sure your markup looks like A, include this script B, and as a result you have a page that can do C".

Try to create small pieces of independent code. The disadvantages of a lot of existing JavaScript code libraries are that you often have to include a lot more code than you really need and that they are harder to understand and maintain if you didn't create them yourself. Because the functions in these libraries are often grouped and reused by other scripts, it often feels like they are spaghetti-coded. A library with small unobtrusive scripts has the advantage of being light-weight, easy to be understood and easy to be adjusted for more specific implementations.

Create reusable code. If you find yourself duplicating code snippets(鐗囨), create functions. If you find yourself duplicating(澶嶅埗) similar code snippets, try to abstract your code to the level that you can reuse it for multiple purposes.

Document your code well. If you work together with other people, like to share your code with others, or still want to know why you did certain things one year from now, good documentation is key.

5. Create future-proof JavaScript

Avoid browser detection, because it is almost impossible to maintain in the future. Feature testing or object detection offers a browser independent and future-proof technique to test to what extent your Web client supports JavaScript.

XHTML (if not used in backwards-compatible mode) introduces media type application/xhtml+xml (currently unsupported by Internet Explorer), which has a huge impact on how we write JavaScript code:

  • The HTML DOM is case-insensitive, the XML DOM is case-sensitive (鍖哄垎澶у皬鍐?
  • Elements need to be referenced in lowercase, e.g. document.getElementsByTagName("p")
  • document.body is deprecated, instead reference it by id or use document.getElementsByTagName("body").item(0)
  • Collections like document.images, document.applets, document.links, document.forms and document.anchors do not exist when serving XHTML as XML, instead use document.getElementsByTagName()
  • innerHTML and document.write cannot be used anymore, instead use DOM methods, e.g. document.createElementNS("http://www.w3.org/1999/xhtml", "div")

If you want to keep yourself up-to-date with the latest developments, there are a lot of initiatives from different organisations that will impact the ways we use JavaScript and the DOM in the near future:

  • W3C
    • DOM 3 provides further XML and XPath integration
    • XHTML 2 includes XML Events, which introduces a declarative way to hook up event observers via markup, and XForms, which will change the way how we add behavior to forms
    • CSS3 introduces new pseudo-elements
  • ECMA
  • Browser vendors
    • Standards support, e.g. at the moment it is still a big question if Microsoft will ever fully support existing Web Standards and is going to support future standards
    • The addition of proprietary methods and attributes, e.g. innerHTML, Microsoft.XMLHTTP and XMLHttpRequest
    • Collaborations like the WHAT WG aimed to create new standards in shorter timeframes, e.g. the submission of Web Forms 2 to become a W3C recommendation and Web Applications, which in the future may standardise XMLHttpRequest

6. Know JavaScript's weaknesses(寮辯偣), limitations錛堥檺鍒訛級 and bugs

Although JavaScript is generally well supported by most modern Web clients, support still remains its biggest weakness. Because from the first days of the Web users were often harassed(鐤插︾殑) by all kinds of annoying(璁ㄥ帉鐨? behavior, browser makers decided to make it easy to switch JavaScript off (Windows XP Service Pack 2 even disables some JavaScript by default, because it regards it as active scripting). If you compare JavaScript with its little stepbrother ActionScript (which is supported when the Flash plug-in is installed and cannot be switched off), you will find that the main difference is that you can rely on its behavior to accomplish certain tasks. Because it is just too easy to switch JavaScript off, simple tasks like form validation always need to be duplicated at the server side. It will be for this reason that in the future most client-side form validation will be replaced by markup and 'built-in behavior'.

As mentioned earlier, the onload event handler is insufficient to get the best out of unobtrusive techniques. I hope that the people of the W3C will respond to this feedback from the JavaScript community and add new handlers like onElementLoad and onDOMLoad to future DOM specifications.

The JavaScript implementations of Internet Explorer and Safari suffer from memory leaks when using circular references like closures. When using circular references, make sure you remove event handlers when a page is unloaded.

7. Often there is more than one good solution

JavaScript is a very flexible language and as a result you often have multiple ways of doing things. You could choose for either a procedural(紼嬪簭涓? or an object oriented way of coding. For your unobtrusive behavior you can either use custom attributes or use class attributes as triggers to fully control the behavior of your site. Flexibility implies that you have to make certain choices, however often one solution is not necessarily better or worse than another. Base your decisions on the context in which you have to use your scripts and your own philosophy or taste and try to use a consistent coding style.

8. Write your own scripts or reuse code from trusted places

Currently a lot of outdated(榪囨湡鐨? and badly written code is available on the Internet. Many scripts are plagued by browser detection, are using proprietary features that don't work cross-browser, are inaccessible or are not separating behavior from structure, because they rely on inline event handlers and scripts. It seems that Web Standards, Web clients and the practice of writing good JavaScript have evolved so quickly in the past two years, that it is hard to keep up with the latest good practices. This on its turn makes it hard to reuse code from others or reuse code you wrote yourself a year ago. Because some parts of older scripts may still contain valid code constructs, it is best to review them and rewrite the parts that don't suffice anymore. You will probably often find that a complete rewrite will do best.

So how do less experienced DOM and JavaScript users tell the difference between good and bad code on the Internet? There are some experts on the Internet that advocate modern ways of scripting and there are communities that discuss and rate new scripts and techniques. Some examples are:

DHTML Utopia: Modern Web Design Using JavaScript & DOM is the first title of a new range of books focusing on the application of modern JavaScript and unobtrusive scripting techniques.

9. Optimize your JavaScript code for performance

Optimize your scripts for both download speed and execution speed. <涓嬭澆閫熷害鍜屾墽琛岄熷害>Some tips:

  • Avoid fat code libraries and make sure your scripts stay lean and mean (or: small, independent and straightforward)
  • Write efficient code and avoid constructs that execute slow
  • Keep developer versions of your scripts that include full comments and use a compression<鍘嬬緝> tool (like JavaScript cruncher or JavaScript Crunchinator) to strip out all comments and white-spaces to create a version for deployment.

10. Use tools to optimize your work process

A selection of tools that make life much easier:

  • Mozilla or Firefox browser
    • Includes the good old Netscape JavaScript console by default (Tools > Web Development > JavaScript Console for Mozilla and Tools > JavaScript Console for Firefox), e.g. to view errors and warnings that make sense
    • The Web Developer Toolbar extension, e.g. to quickly enable or disable your scripts
    • The Mozilla DOM Inspector and the Firefox DOM Inspector extension, to inspect and edit the live DOM of any Web document
    • Venkman, the JavaScript debugger (the Venkman extension for Firefox)
  • JSDoc, a tool that parses inline documentation in JavaScript source files, and produces an HTML summary
  • JSLint, a JavaScript verifier to check for syntax and programming errors.

Back



]]>
Navigator object & userAgenthttp://www.tkk7.com/javaora/archive/2006/01/14/28001.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Sat, 14 Jan 2006 01:55:00 GMThttp://www.tkk7.com/javaora/archive/2006/01/14/28001.htmlhttp://www.tkk7.com/javaora/comments/28001.htmlhttp://www.tkk7.com/javaora/archive/2006/01/14/28001.html#Feedback0http://www.tkk7.com/javaora/comments/commentRss/28001.htmlhttp://www.tkk7.com/javaora/services/trackbacks/28001.htmlThe Navigator object (named after the Netscape web browser, of course) has variables that specify the name and version of the browser that is running, as well as variables that identify the platform on which it is running. These variables allow scripts to customize their behavior based on browser or platform, so that they can take advantage of extra capabilities supported by some versions or work around bugs that exist on some platforms.

userAgent
   The string that the browser sends in its USER-AGENT HTTP header.This property typically contains all the information in both appName and appVersion.

eg.
 this.isIE = navigator.userAgent.toLowerCase().indexOf("msie") >= 0;



]]>
Function.bindAsEventListenerhttp://www.tkk7.com/javaora/archive/2006/01/14/27999.htmljava涓栫晫鐣呰皥java涓栫晫鐣呰皥Sat, 14 Jan 2006 01:35:00 GMThttp://www.tkk7.com/javaora/archive/2006/01/14/27999.htmlhttp://www.tkk7.com/javaora/comments/27999.htmlhttp://www.tkk7.com/javaora/archive/2006/01/14/27999.html#Feedback0http://www.tkk7.com/javaora/comments/commentRss/27999.htmlhttp://www.tkk7.com/javaora/services/trackbacks/27999.htmlname: Function.bindAsEventListener

This provides a new method to the core class Function. The method,called bindAsEventListener(),is used to do bind methods to event handlers.

榪欎負(fù)鏍稿績class 鍑芥暟鏀寔浜嗕竴涓柊鐨勬柟娉曘傝繖涓柟娉曞彨bindAsEventListener(),鏄敤鏉ョ粦瀹氭柟娉曠粰浜嬩歡澶勭悊鍣ㄧ殑銆?BR>var obj = new SomeClass();
var closure = obj.someMethod.bindAsEventListener(this);
element.onclick = closure;



]]>
主站蜘蛛池模板: 久久久久久AV无码免费网站| 日本精品人妻无码免费大全 | 亚洲综合网美国十次| 无码国产精品一区二区免费vr| 91嫩草免费国产永久入口| 免费夜色污私人影院网站| 一级女人18毛片免费| 亚洲天堂一区二区| 免费被黄网站在观看| 免费无码黄网站在线看| 亚洲色大网站WWW永久网站| 亚洲人成国产精品无码| 丁香花免费高清视频完整版| 黄色视屏在线免费播放| 亚洲人成网站看在线播放| 国产自偷亚洲精品页65页| 三级网站免费观看| 亚洲一卡2卡3卡4卡5卡6卡| 亚洲人成人无码网www电影首页| 亚洲美女一区二区三区| 韩国日本好看电影免费看| 免费国产叼嘿视频大全网站| 亚洲AV成人精品日韩一区| 免费人成视频在线观看视频| 国产亚洲精品仙踪林在线播放| 无码精品人妻一区二区三区免费看| 国产成人亚洲综合| 成人免费一区二区无码视频| 全免费a级毛片免费看| 亚洲成人精品久久| 一本久到久久亚洲综合| 国拍在线精品视频免费观看| 在线观看免费无码专区| 成人精品综合免费视频| 亚洲日韩乱码中文无码蜜桃臀| 国产免费久久精品丫丫| 亚洲国产精品18久久久久久| 91亚洲国产成人久久精品| 亚洲AV乱码久久精品蜜桃| 国产中文在线亚洲精品官网| www免费插插视频|