js setTimeout实现延迟关闭弹出层 时间:2020-05-12 人气:0 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetTimeout.aspx.cs" Inherits="JavaScript.SetTimeout" %> <script type="text/javascript"> var flyoutTimer; function mouseOutEvent() { //Hide flyout after 1 second when the mouse move out of the flyout zone flyoutTimer = setTimeout(hideFlyout, 1000); } function mouseOverEvent() { //Clear the timer when the mouse move over the flyout clearTimeout(flyoutTimer); } function hideFlyout() { document.getElementById("flyout").style.display = "none"; } function showFlyout() { document.getElementById("flyout").style.display = "block"; mouseOutEvent(); } </script> Click me to show flyout This is a flyout [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 加载全部内容