JS brother node traversal; JS setTimeout for script Testing

Source: Internet
Author: User
Templi. onmouseover = Function  (){  This . Style. backgroundcolor = "# fff68f" ;  VaR Tempfun = This  . Previussibling;  While (Tempfun! = Null  ) {Tempfun. style. backgroundcolor = "Fff5d2" ; Tempfun =Tempfun. previussibling;} tempfun = This  . Nextsibling;  While (Tempfun! = Null  ) {Tempfun. style. backgroundcolor = "Fff5d2" ; Tempfun = Tempfun. nextsibling ;}}; 

2. Execute a method repeatedly in JS setTimeout.

/* Count: Number of start points
Call method: scripttest (0)
Result: hello11 times
Function scripttest (count) {If (count <10) {count ++; // auto-increment alert ("hello"); // setTimeout (function () {scripttest (count) ;}, 1000); // self-called }}


// When you move the room, you do not have to order it again or again.

/* FUNC: function name time: number of executions */function scripttest (count) {If (count <20) {// total number of times count ++; // auto-increment // alert ("hello"); setposition (count); // main function body setTimeout (function () {scripttest (count) ;}, 1000 ); // self-called }}




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.