3. Data Object

Source: Internet
Author: User

1. Create part1.html

1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312" />5 <title>Use of Date objects-clock effects</title>6 <Scripttype= "Text/javascript">7 window.onload=function(){8   //gets the first input label9    varInputone=document.getElementsByTagName ("input")[0];Ten     One    //Add a Click event to the input tag A Inputone.onclick=function(){ - SetTimeout ("Timefun ()", -); -    } the     -    //get the 2nd input tag -    varInputtwo=document.getElementsByTagName ("input")[1]; -     +    //Add a Click event to the input tag -   varTimestr; + Inputtwo.onclick=function(){ A Timestr=SetInterval ("Timefun ()", +); at    } -     -     //get the 2nd input tag -    varInputthree=document.getElementsByTagName ("input")[2]; -     -    //Add a Click event to the input tag in Inputthree.onclick=function(){ - clearinterval (TIMESTR); to    } +  - } the  * functionTimefun () { $    varDate=NewDate ();Panax Notoginseng    var Year=date.getfullyear ();//get four-bit year -    varMonth=Date.getmonth ()+1; //Month the    var Day=date.getdate ();//one day in one months, range 1-31 +    varWeek=Date.getday ();//Week A    varHour=date.gethours ();//number of hours, 24 binary the    varminutes=date.getminutes ();//minutes +    varSecond=date.getseconds (); //seconds -    var Time= Year+"years" $            +Month+"Month" $            + Day+"Day Week"+Week+"  " -            +Hour+"when"+minutes+"points"+Second+"seconds";  - Console.log (time); the document.getElementsByTagName ("Div")[0].innerhtml=Time ; -   Wuyi     the } - </Script> Wu </Head> -  About <Body> $ <inputtype= "button"value= "appears after 3 seconds"/> - <inputtype= "button"value= "Dynamic Clock"/> - <inputtype= "button"value= "Stop Clock"/> - <DivID= "Time"> A </Div> + </Body> the </HTML>
Date object implements clock effects

2.

3. Click "Three seconds to appear"

4. Click on the dynamic clock

5, click Stop Clock, Time will stop each second refresh

3. Data Object

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.