如何用JQuery编写定时弹出长尾词广告代码?

2026-04-03 10:081阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计430个文字,预计阅读时间需要2分钟。

如何用JQuery编写定时弹出长尾词广告代码?

JavaScript相关技术+定时器:setInterval、clearInterval、setTimeout、clearTimeout+显示:img.style.display=block+隐藏:img.style.display=none+img对象+style属性+分析:用户打开界面,3秒后弹出窗口

Js相关技术

定时器:

​ setInterval & clearInterval
​ setTimeout & clearTimeout

显示: img.style.display = "block"

隐藏: img.style.display = "none"

img 对象

style属性: style对象

需求分析

如何用JQuery编写定时弹出长尾词广告代码?

当用户打开界面,3秒钟之后弹出广告,这个广告显示5秒钟,隐藏广告

技术分析

定时器: setTimeout

显示和隐藏: style.display = "block/none"

步骤分析:

  • 导入JQ的文件
  • 编写JQ的文档加载事件
  • 启动定时器 setTimeout("",3000);
  • 编写显示广告的函数
  • 在显示广告里面再启动一个定时器
  • 编写隐藏广告的函数

代码实现

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script> <!-- 1. 导入JQ的文件 2. 编写JQ的文档加载事件 3. 启动定时器 setTimeout("",3000); 4. 编写显示广告的函数 5. 在显示广告里面再启动一个定时器 6. 编写隐藏广告的函数 --> <script> //显示广告 function showAd(){ $("#img1").slideDown(2000); setTimeout("hideAd()",3000); } //隐藏广告 function hideAd(){ $("#img1").slideUp(2000); } $(function(){ setTimeout("showAd()",3000); }); </script> </head> <body> <img src="../img/f001a62f-a49d-4a4d-b56f-2b6908a0002c_g.jpg" id="img1" width="100%" style="display:none" /> </body> </html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。

本文共计430个文字,预计阅读时间需要2分钟。

如何用JQuery编写定时弹出长尾词广告代码?

JavaScript相关技术+定时器:setInterval、clearInterval、setTimeout、clearTimeout+显示:img.style.display=block+隐藏:img.style.display=none+img对象+style属性+分析:用户打开界面,3秒后弹出窗口

Js相关技术

定时器:

​ setInterval & clearInterval
​ setTimeout & clearTimeout

显示: img.style.display = "block"

隐藏: img.style.display = "none"

img 对象

style属性: style对象

需求分析

如何用JQuery编写定时弹出长尾词广告代码?

当用户打开界面,3秒钟之后弹出广告,这个广告显示5秒钟,隐藏广告

技术分析

定时器: setTimeout

显示和隐藏: style.display = "block/none"

步骤分析:

  • 导入JQ的文件
  • 编写JQ的文档加载事件
  • 启动定时器 setTimeout("",3000);
  • 编写显示广告的函数
  • 在显示广告里面再启动一个定时器
  • 编写隐藏广告的函数

代码实现

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script> <!-- 1. 导入JQ的文件 2. 编写JQ的文档加载事件 3. 启动定时器 setTimeout("",3000); 4. 编写显示广告的函数 5. 在显示广告里面再启动一个定时器 6. 编写隐藏广告的函数 --> <script> //显示广告 function showAd(){ $("#img1").slideDown(2000); setTimeout("hideAd()",3000); } //隐藏广告 function hideAd(){ $("#img1").slideUp(2000); } $(function(){ setTimeout("showAd()",3000); }); </script> </head> <body> <img src="../img/f001a62f-a49d-4a4d-b56f-2b6908a0002c_g.jpg" id="img1" width="100%" style="display:none" /> </body> </html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。