zoukankan      html  css  js  c++  java
  • onmouseover事件

    复制代码
     1 function create(mouse){
     2     var num=44;
     3     var bgcolor='#';
     4     var body=document.getElementsByTagName('body')[0];
     5     var div=document.getElementsByTagName('div');
     6 //    var scr_x=document.documentElement.scrollLeft;
     7 //    var scr_y=document.documentElement.scrollTop;
     8     var arr=new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
     9     for (var i=0;i<6;i++) {
    10         var index=Math.floor(Math.random()*arr.length);
    11         bgcolor+=arr[index];        
    12     }    
    13     for (var j=0;j<num;j++) {
    14         var rand=Math.random()*40;
    15         div[j]=document.createElement('div');
    16         body.appendChild(div[j]);
    17         div[j].style.position='absolute';//必不可少,否则不随鼠标移动
    18         div[j].style.width=div[j].style.height=rand+'px';
    19         div[j].style.borderRadius='50%';
    20         div[j].style.backgroundColor=bgcolor;
    21         div[j].style.opacity=Math.random();24         div[j].style.left=mouse.clientX+rand*i+'px';
    25         div[j].style.top=mouse.clientY+Math.random()*40*i+'px';        
    26     }
    27 }
    28 document.onmousemove=create;
    复制代码
  • 相关阅读:
    IOC
    软件问题
    POJO和JavaBean
    tail命令
    实现质数遍历并输出所需时间
    完数
    break、continue
    *各种形状
    for、while、do-while
    jenkins实现maven项目自动化部署tomcat
  • 原文地址:https://www.cnblogs.com/xieweikai/p/6837919.html
Copyright © 2011-2022 走看看