div跟随javasript

来源:互联网 发布:彩虹岛登陆网络传输 编辑:程序博客网 时间:2024/05/21 09:32

function showdiv() {

var x = window.event.x;
var y = window.event.y;
var show = document.getElementById("ShowInfo");
show.style.visibility 
= "visible";
show.style.top 
= y;
show.style.left 
= x;
show.style.background
="#ffff00";
show.innerHTML 
= "1234567";
document.onmousemove 
= moveToMouseLoc;
}


function Remove()
{
        
var show=document.getElementById("ShowInfo");
        
if(show != "" || show != null)
        
{
            show.style.visibility 
= "hidden";
        }
    
}

function moveToMouseLoc(e)
{
    x 
= window.event.x;
    y 
= window.event.y;
  
var show = document.getElementById("ShowInfo");
  show.style.left 
= x;
  show.style.top 
= y;
  
return true;
}


 
原创粉丝点击