APP instance code parsing in the JS extension prompt box _ javascript skills

Source: Internet
Author: User
This article mainly introduces the information about app instance code parsing in the JS extension prompt box. If you need more information, refer to the code below and paste it directly. The specific code is as follows:

 Delayed display prompt boxScript window. onload = function () {var oDiv1 = document. getElementById ('p1'); var oDiv2 = document. getElementById ('p2 '); var timer = null; // oDiv1.onmouseover = function () {// clearTimeout (timer); // oDiv2.style. display = 'block'; // p2 //} displayed when the mouse moves to p1; // oDiv1.onmouseout = function () {// timer = setTimeout (function () {// oDiv2.style. display = 'none'; // hide p2 //}, 500) when you move the cursor FROM p1; // to move the cursor from p1 to p2, so when P2. p2 is removed from p1, there should be a latency setting //}; // oDiv2.onmouseover = function () {// clearTimeout (timer); // clear the extension setting, when the mouse moves to p2, p2 should display //}; // oDiv2.onmouseout = function () {// timer = setTimeout (function () {// oDiv2.style. display = 'none'; // p2 should be hidden when the mouse is removed from p2 //}, 500); // when the mouse is removed from p2 and moved to p1, p2 will flash and then display, set a delay to clear the flickering effect; // But after setting the delay, p2 is hidden when the mouse moves to p1, because setTimeout, //// the extension sequence should be cleared, and the code of the extension sequence should be added to the oDiv1.onmouseover event to clear the code of the extension sequence. /// because the codes of the four events are identical or similar to each other, you can simplify the process as follows: oDiv1.onmouseover = oDiv2.onmouseover = function () {clearTimeout (timer); oDiv2.style. display = 'block';/* p2 is displayed when the mouse moves to p1, although oDiv2.onmouseover is not written in oDiv2.style. display = 'block'; but in fact, oDiv2 is in the 'block' state. Writing more code does not substantially affect */}; oDiv1.onmouseout = oDiv2.onmouseout = function () {timer = setTimeout (function () {oDiv2.style. display = 'none'; // hide p2}, 500 when you move the cursor from p1 to p2. // there should be a latency setting when you move p2 from p1 to p2 }; // The simplified code execution result is exactly the same as the preceding code .} scriptDelayed prompt box

Note the notes that need to be noted when writing the delayed prompt box. Note the notes one by one. After reading the video tutorial, this function is smooth, the reason is that a list of required functions is implemented one by one according to the list before writing the code. If there is a problem, it is much better to adjust the corresponding functions than to write the code directly.

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.