首页 > 其他分享 >插入随机/跟随鼠标/点击一次即消失/漂浮图片(ie测试通过)

插入随机/跟随鼠标/点击一次即消失/漂浮图片(ie测试通过)

时间:2023-04-28 22:32:42浏览次数:36  
标签:leftChange http 鼠标 gif ie 测试通过 var logo com


//跟随方法比document.click不足之处:当出现cpu占用过高时,会出现跟随不上现象,导致此次点击并不能弹出窗口

var imgs = new Array("http://www.google.cn/intl/zh-CN/images/logo_cn.gif",
                      "http://hp.tom.com/images/logo.gif",
                      "http://img1.qq.com/news/pics/9499/9499744.gif",
                      "http://l.yimg.com/a/i/ww/beta/y3.gif",
                      "http://i3.sinaimg.cn/home/deco/2008/0325/sinahome_Logo.gif",
                      "http://cimg2.163.com/cnews/img/logo0202.gif",
                      "http://www.skycn.com/images/logo.gif",
                      "http://pics.taobao.com/bao/album/logo/logo200803.gif",
                      "http://pics.ebaystatic.com/aw/pics/logos/logoEbay_x45.gif",
                      "http://img.baidu.com/img/post-jg.gif",
                      "http://go.com/static/images/goredesign2006/clear.gif",
                      "http://logo.com/assets/topbanner/logotron.jpg",
                      "http://www.192.com/imgs/192.gif",
                      "http://10010.com/firm/images/logo_to.gif",
                      "http://10000.com/logo.gif",
                      "http://cn.yimg.com/i/realn/fp/reanalg.gif",
                      "http://tn1.cn3.yahoo.com/image/65d/1432ecbd693d111a3e.jpeg"
                     );   
         
var flyTimer;
var topChange = 3;
var leftChange = 3;
var flyTop = parseInt(Math.random() * 500);
var flyLeft = parseInt(Math.random() * 900);function imgFly()
{
   flyTop = flyImg.style.top = flyTop + parseInt(Math.random() * topChange);
   flyLeft = flyImg.style.left = flyLeft + parseInt(Math.random() * leftChange);
   
   if ( (flyLeft < 0) && (leftChange < 0))
   {
      leftChange = 3;
   }else if ( (flyLeft > 900) && (leftChange > 0) )
    {
       leftChange = -3;
    }
   
   if ( (flyTop < 0) && (topChange < 0))
   {
      topChange = 3;
   }else if ( (flyTop > 500) && (topChange > 0) )
    {
       topChange = -3;
    }
   
   flyTimer = setTimeout("imgFly()",50);
}document.write('<a href="http://www.qq.com" style="text-decoration: none;"><img id=flyImg src="' + imgs[parseInt(imgs.length * Math.random())] + '" style="border:0px;top:-100px; left:-100px; position:absolute;"></a>');
imgFly();
function document.onmousemove()
{
  if (blankImg.style.display == "inline")
  {
   blankImg.style.top = event.clientY - 10;
   blankImg.style.left = event.clientX-10;
  }
}document.write('<a href="http://www.qidizi.com" target="_blank" style="text-decoration: none;"><img id=blankImg src="blank.gif" style="border:0px;top:-100px; left:-100px; position:absolute; display:inline;" οnclick="this.style.display=/'none/';"></a>');
blankImg.setCapture(true);

 

标签:leftChange,http,鼠标,gif,ie,测试通过,var,logo,com
From: https://blog.51cto.com/u_252283/6235725

相关文章

  • 支持ff/ie的form内容必填出错提示
    当前控件填写有误,则后面显示表示错误图片,并首个对象获得焦点,ff/ie通过 可以修改一下js达到不必每个控件后面先放一图片,可以动态生成,再消掉<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htm......
  • 20042124_chappie
    [换成自己的源]docker-machinesshdefaultsed-i"s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=https://2w188x2k.mirror.aliyuncs.com|g"/var/lib/boot2docker/profileexitdocker-machinerestartdefault [打开rknndocker]dockerrun-t-i--privilege......
  • GridView中CheckBox的数据绑定显示选中和未选中问题
    https://www.cnblogs.com/zxd543/p/3121169.html效果如下(以会员价为例)会员价(MemberPrice)字段的数据库类型为int(1表示true,0表示false)页面绑定如下:<asp:TemplateFieldHeaderText="会员价"><ItemStyleHorizontalAlign="Center"Width="60px"/>......
  • 解决 ERROR:Docker Got permission denied while trying to connect to the Docker da
    解决ERROR:DockerGotpermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix在终端执行"dockerversion"命令,出现如下报错:”GotpermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix:///var/run/docker.sock:Gethttp......
  • Vue插件图片预览hevue-img-preview
    安装#安装npminstallhevue-img-preview--save#main.js引入importhevueImgPreviewfrom'hevue-img-preview'Vue.use(hevueImgPreview)#使用#//给任意对象添加任意事件,例如<img:src="imgurl"@click="previewImg(imgurl)">#//在事件里调用方法进行预......
  • 兼容IE解决[date] Invalid Date问题
    ProblemIncaseyourdateisstoredinSQLdatetimelike2020-04-0705:30:00andwanttoparseitinIE.WhenyouparseitwithJavaScriptinIEusingnewDate(),itoutputsInvalidDatewhilelatestversionsofChromeandFirefoxparsethisdatecorrectl......
  • css cursor: url 自定义鼠标光标遇到的坑
    1、大小不能大于32*32(切记)本人就是在这个上面栽了很久,一直出不来2、最好是ico,cur格式3、使用绝对路径4、在逗号后面加通用游标,如官网所写 示例:map.style.cursor="url('/img/cursor.ico'),pointer";附:在线修改图片大小网址:在线图片大小修改器,图片尺寸修改,格式转换【免费】png等......
  • 为HttpClient开启HTTP/2
    .NetCore在调用其他服务时,调用通常使用HttpClient,而HttpClient默认使用HTTP/1.1。  配置HttpClient以使用HTTP/2h2连接自.NETCore3.0发布以来,.NET开发人员可以使用HttpClient启用HTTP/2。 设置HTTP/2的方法DefaultRequestVersion和DefaultVersionP......
  • jquery:临时禁止鼠标滚动 How to disable scrolling temporarily?
    1.代码://left:37,up:38,right:39,down:40,//spacebar:32,pageup:33,pagedown:34,end:35,home:36varkeys={37:1,38:1,39:1,40:1};functionpreventDefault(e){e=e||window.event;if(e.preventDefault)e.preventDefault()......
  • 【HarmonyOS】元服务WebView组件 H5使用localstorage
    在日常开发中我们会在应用种接入H5网页,localStorage作为H5本地存储webstorage特性的API之一,主要作用是将数据保存在客户端中。对于快速开发元服务,通过WebView组件运行H5如何使用localstorage呢?下文以API7JavaUI为例为大家做相关的讲解。 【实现步骤】第一步、配置WebView首......