如何用JavaScript编写一个实现长尾词关键词的抽奖效果程序?

2026-04-06 12:371阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

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

如何用JavaScript编写一个实现长尾词关键词的抽奖效果程序?

开始抽奖啦! * { margin: 0; padding: 0; } .title { width: 400px; height: 70px; margin: 0 auto; padding-top: 30px; text-align: center; font-size: 24px; font-weight: bold; color: ; } 开始抽奖啦!

如何用JavaScript编写一个实现长尾词关键词的抽奖效果程序?

html

开始抽奖啦! 开 始 停 止 css

* { margin:0; padding:0; } .title { width:400px; height:70px; margin:0 auto; padding-top:30px; text-align:center; font-size:24px; font-weight:bold; color:#F00; } .btns { width:190px; height:30px; margin:0 auto; } .btns span { display:block; float:left; width:80px; height:27px; line-height:27px; background:#036; border:1px solid #eee; border-radius:7px; margin-right:10px; color:#FFF; text-align:center; font-size:14px; font-family:"微软雅黑"; cursor:pointer; } js

var data = ['Phone5', 'Ipad', '三星笔记本', '佳能相机', '惠普打印机', '谢谢参与', '50元充值卡', '1000元超市购物券'], timer = null, flag = 0; window.onload = function() { var play = document.getElementById('play'), stop = document.getElementById('stop'); // 开始抽奖 play.onclick = playFun; stop.onclick = stopFun; // 键盘事件 document.onkeyup = function(event) { event = event || window.event; if (event.keyCode == 13) { if (flag == 0) { playFun(); flag = 1; } else { stopFun(); flag = 0; } } } } function playFun() { var title = document.getElementById('title'); var play = document.getElementById('play'); clearInterval(timer); timer = setInterval(function() { var random = Math.floor(Math.random() * data.length); title.innerHTML = data[random]; }, 50); play.style.background = '#999'; } function stopFun() { clearInterval(timer); var play = document.getElementById('play'); play.style.background = '#036'; }

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

如何用JavaScript编写一个实现长尾词关键词的抽奖效果程序?

开始抽奖啦! * { margin: 0; padding: 0; } .title { width: 400px; height: 70px; margin: 0 auto; padding-top: 30px; text-align: center; font-size: 24px; font-weight: bold; color: ; } 开始抽奖啦!

如何用JavaScript编写一个实现长尾词关键词的抽奖效果程序?

html

开始抽奖啦! 开 始 停 止 css

* { margin:0; padding:0; } .title { width:400px; height:70px; margin:0 auto; padding-top:30px; text-align:center; font-size:24px; font-weight:bold; color:#F00; } .btns { width:190px; height:30px; margin:0 auto; } .btns span { display:block; float:left; width:80px; height:27px; line-height:27px; background:#036; border:1px solid #eee; border-radius:7px; margin-right:10px; color:#FFF; text-align:center; font-size:14px; font-family:"微软雅黑"; cursor:pointer; } js

var data = ['Phone5', 'Ipad', '三星笔记本', '佳能相机', '惠普打印机', '谢谢参与', '50元充值卡', '1000元超市购物券'], timer = null, flag = 0; window.onload = function() { var play = document.getElementById('play'), stop = document.getElementById('stop'); // 开始抽奖 play.onclick = playFun; stop.onclick = stopFun; // 键盘事件 document.onkeyup = function(event) { event = event || window.event; if (event.keyCode == 13) { if (flag == 0) { playFun(); flag = 1; } else { stopFun(); flag = 0; } } } } function playFun() { var title = document.getElementById('title'); var play = document.getElementById('play'); clearInterval(timer); timer = setInterval(function() { var random = Math.floor(Math.random() * data.length); title.innerHTML = data[random]; }, 50); play.style.background = '#999'; } function stopFun() { clearInterval(timer); var play = document.getElementById('play'); play.style.background = '#036'; }