First, loading--(Used to load files located on a Web page, not local) example:
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title></Head><Body> <DivID= "Div1">Loading ...<spanID= "Span1">0%</span></Div></Body><Scripttype= "Text/javascript"> vararr=["http://h.hiphotos.baidu.com/image/pic/item/00e93901213fb80e6c1c307635d12f2eb8389445.jpg","http://e.hiphotos.baidu.com/image/pic/item/5882b2b7d0a20cf4d51141c275094b36acaf992e.jpg","http://f.hiphotos.baidu.com/image/pic/item/d62a6059252dd42aedabbeb6003b5bb5c9eab809.jpg"]; varDiv1=document.getElementById ("Div1"); varSpan1=document.getElementById ("Span1"); varIMGs=[]; varIndex=0; for (varI=0; I<arr.length; I++){ varimgobj=NewImage (); IMGOBJ.SRC=Arr[i]; Imgobj.onload=function() {index++; Span1.innerhtml=parseint (Index/arr.length*100) + "%";Imgs.push ( This); if(Index==arr.length) { //load all finisheddiv1.innerhtml=""; for (varJ=0; J<Arr.length; J++) {div1.appendchild (imgs[j]); } } } }</Script></HTML>
- Domcontentloaded: equivalent to onload
Second, read--window.onload load faster than HTML parts
- Window.onload:html,css,image,js, audio, flash
- Read:dom,css
Iii. Commission of events
- E.target: Triggered object, ul1 for object
- E.target.tagname: Gets the event source, the tag name of the triggered object, and the label for the UL1
- Compatible:
- E.target: for advanced browsers
- E.srcelement: For low-level browsers
iv. Communication of parameters
- Method one (most primitive)
- Method Four (high-end practical)
JS Event 3