这篇文章主要介绍了js简单实现浮动窗口效果,涉及javascript操作浮动窗口的创建、打开、关闭等相关操作技巧,需要的朋友可以参考下
本文实例讲述了JS简单实现浮动窗口效果。分享给大家供大家参考,具体如下:
HTML部分:
无标题文档
JS部分:
// JavaScript Document
//浮动广告图片
var floatAdImg = "images/onlineSay.jpg";
//浮动侧栏图片
var floatSideImg = "images/onlineTel.gif";
//打开在线沟通
function open_online()
{
window.open('http://p.qiao.baidu.com//im/index?siteid=7342332&ucid=7601325');
}
//浮动广告
document.writeln("");
document.writeln("
");
document.writeln("");
document.writeln("");
//浮动侧栏
document.writeln("");
//关闭浮动广告
function closeFAd()
{
document.getElementById('floatAd').style.display = 'none';
}
//打开浮动广告
function showFAd()
{
document.getElementById('floatAd').style.display = 'block';
}
//打开浮动窗口
function showFloat()
{
document.getElementById('floatAd').style.display = 'block';
}
//打开窗口 20 秒仅执行一次
setTimeout(showFAd,20000);
//每个 30 秒执行一次
setInterval(showFloat,30000);
效果图如下:

相关推荐:










