JS---08 function timer

Source: Internet
Author: User

<! DOCTYPE html>//number, String, Boolean, function, object (element \ array \json\null), undefinedAlert (FN1 (). length);//5AlerttypeofFN1 ());//stringfunctionfn1 () {//return;    return' Miaov ';} Alert (fn2 ());//Returning function Body function (b) {alert (a+b);};FN2 (20) (10);functionFn2 (a) {return function(b) {alert (a+B);// -    };} Fn3 (). OnLoad=function() {Document.body.innerHTML= 123;};functionFn3 () {returnwindow;} Alert (Fn4 ());functionFn4 () {//return; No return, no definition returned}alert (Fn5 ());functionfn5 () {return123; Alert (520);//no longer executed}</script><script>window.onload=function (){    //var obtn = document.getElementById (' btn1 ');    //var odiv = document.getElementById (' Div1 ');$ (' btn1 '). onclick =function() {alert ($ (' Div1 '). InnerHTML); };};function$ (ID) {returndocument.getElementById (ID);}</script><script>fn1 (The ); functionfn1 (a,b,c) {}functionFn1 () {//do not write formal parameter name, also passed in, arguments inside,    //arguments = [a collection of]--argumentsalert (arguments);//Objectalert (arguments.length); Alert (Arguments[arguments.length-1] );}//when the number of arguments to a function cannot be determined: use argumentsAlert (sum ());//6Alert (sum (1,2,3,4));//Tenfunctionsum () {varn = 0;  for(vari=0; i<arguments.length; i++) {n+=Arguments[i]; }    returnN;}varA = 1;functionFn2 (a) {arguments[0] = 3; alert (a);//3    varA = 2; Alert (arguments[0]);//2}fn2 (a); alert (a);//1</script><script>window.onload=function (){    varMiaov = document.getElementById (' Miaov ')); //Nesting of timed executions, out after 2 seconds, closed after 3 secondsSetTimeout (function() {Miaov.style.display= ' Inline-block '; SetTimeout (function() {Miaov.style.display= ' None '; }, 3000); },  2000);};</script>
<! DOCTYPE html>ul {padding:0; margin:0; } Li {List-Style:none;} Body {background:#333; } #pic {width:400px; height:500px; position:relative; margin:0 auto; Background:url (img/loader_ico.gif) no-repeat Center #fff; }#pic img {width:400px; height:500px;} #pic ul {width:40px; position:absolute; Top:0; right:-50px;} #pic li {width:40px; height:40px; margin-bottom:4px; Background: #666; } #pic. Active {background: #FC3;} #pic span {top:0; } #pic p {bottom:0; margin:0; } #pic p, #pic span {position:absolute; Left:0; width:400px; height:30px; line-height:30px; Text-align:center; Color: #fff; Background: #000; }</style><script>window.onload=function (){    varOdiv = document.getElementById (' pic '); varoimg = Odiv.getelementsbytagname (' img ') [0]; varOspan = Odiv.getelementsbytagname (' span ') [0]; varOP = Odiv.getelementsbytagname (' P ') [0]; varOul = Odiv.getelementsbytagname (' ul ') [0]; varALi = oul.getelementsbytagname (' li '); varArrurl = [' img/1.png ', ' img/2.png ', ' img/3.png ', ' img/4.png ' ]; varArrtext = [' Little pet ', ' picture Two ', ' Picture Three ', ' mask ' ]; varnum = 0; varTimer =NULL; functionAutoPlay () {Timer= SetInterval (function() {num++; Num%=arrtext.length;        Fntab (); }, 1000); }    //AutoPlay ();SetTimeout (AutoPlay, 2000 ); Odiv.onmouseover=function() {cleartimeout (timer);//Remove Stop Timer    }; Odiv.onmouseout= AutoPlay;//move up to execute the timer, AutoPlay no parentheses, parentheses indicate the return value,     for(vari=0; i<arrurl.length; i++) {oul.innerhtml+ = ' <li></li> '; }    //Initialize    functionFntab () {oimg.src= Arrurl[num];//Initialize to 0 imagesospan.innerhtml = 1+num+ '/' +arrurl.length; Op.innerhtml= Arrtext[num];//Initialize to 0 words         for(vari=0; i<ali.length; i++) {Ali[i].classname= ' '; } ali[num].classname= ' Active ';    } fntab ();  for(vari=0; i<ali.length; i++) {Ali[i].index= i;//Index ValueAli[i].onclick =function() {num= This. Index;        Fntab ();    }; }};</script>
<! DOCTYPE html>#qq {width:200px; height:400px; background: #F9C;} #title {width:240px; height:180px; background: #FC6; position:absolute; top:10px; left:220px; display:none;}</style><script src= "Miaov.js" ></script><script>$(function(){    varQQ = $ (' QQ '); vartitle = $ (' title '); varTimer =NULL; Qq.onmouseover=Show; Qq.onmouseout=Hide; Title.onmouseover=Show; Title.onmouseout=Hide; functionShow () {clearinterval (timer);//The front timer is on, now it's off, it's not going to show .Title.style.display = ' block '; }    functionHide () {Timer= SetTimeout (function() {Title.style.display= ' None '; }, 200); }});</script>

JS---08 function timer

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.