资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
js setTimeout实现延迟关闭弹出层
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetTimeout.aspx.cs" Inherits="JavaScript.SetTimeout" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> #flyout { border: solid 2px Gray; background-color: #FFF999; width: 300px; height: 100px; display: none; } </style> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0Avar%20flyoutTimer%3B%20%0D%0Afunction%20mouseOutEvent()%20%7B%20%0D%0A%2F%2FHide%20flyout%20after%201%20second%20when%20the%20mouse%20move%20out%20of%20the%20flyout%20zone%20%0D%0AflyoutTimer%20%3D%20setTimeout(hideFlyout%2C%201000)%3B%20%0D%0A%7D%20%0D%0Afunction%20mouseOverEvent()%20%7B%20%0D%0A%2F%2FClear%20the%20timer%20when%20the%20mouse%20move%20over%20the%20flyout%20%0D%0AclearTimeout(flyoutTimer)%3B%20%0D%0A%7D%20%0D%0Afunction%20hideFlyout()%20%7B%20%0D%0Adocument.getElementById(%22flyout%22).style.display%20%3D%20%22none%22%3B%20%0D%0A%7D%20%0D%0Afunction%20showFlyout()%20%7B%20%0D%0Adocument.getElementById(%22flyout%22).style.display%20%3D%20%22block%22%3B%20%0D%0AmouseOutEvent()%3B%20%0D%0A%7D%20%0D%0A%3C%2Fscript%3E"> </head> <body> <form id="form1" runat="server"> <div onclick="showFlyout()"> Click me to show flyout</div> <div id="flyout" onmouseout="mouseOutEvent()" onmouseover="mouseOverEvent()"> This is a flyout </div> </form> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程