JS Event 3

Source: Internet
Author: User
Tags tag name

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 Two
    • Method Three
    • Method Four (high-end practical)

JS Event 3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.