广告浮动

广告浮动
代码如下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="../jqury/jQury/jquery-1.11.1.min.js"></script>
<script>
var x=50;
var y=60;
var delay=10;
var nx=true,ny=true;
var step=1;
var timer;
function ajax1(){
    var xmlhttp;
    if(window.XMLHttpRequest){
        xmlhttp=new XMLHttpRequest();
    }else{
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function(){
         if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
    }
    xmlhttp.open("get","js6.html?fname=mike&lname=gate",true);
    xmlhttp.send();
}

function move(){
    var l=0;
    var t=0;
    var yx=document.getElementById("apDiv1");
    var r=document.documentElement.offsetWidth-document.getElementById("apDiv1").offsetWidth;
    var b=document.documentElement.clientHeight-document.getElementById("apDiv1").clientHeight;
    yx.style.left=x+"px";
    yx.style.top=y+"px";
    x=x+step*(nx?1:-1);
    if(x<l){nx=true;x=l;}
    if(x>r){nx=false;x=r;}
    y=y+step*(ny?1:-1);
    if(y<t){ny=true;y=t;}
    if(y>b){ny=false;y=b;}
    timer=setTimeout("move()",delay);
}
function stopTimer(){
    clearTimeout(timer);
}
function close1(){
    document.getElementById("apDiv1").style.display="none";
}
$(document).ready(function(){
                $("#apDiv1",this).hover(function(){
                        $("#button1",this).fadeIn();
                                         });
                $("#apDiv1",this).mouseleave(function(){
                        $("#button1",this).fadeOut();
                                         });
                           });
</script>
<style type="text/css">
<!--
#apDiv1 {
    position:absolute;
    left:8px;
    top:0px;
    width:150px;
    height:76px;
    z-index:1;
    background-color: #FF0000;
}
#button1{
    position:absolute;
    bottom:0;
    right:0;
    filter:alpha(opacity=40%);
    opacity:0.4;
    color:#00F;
    display:none;
}
#img1{
    width:100%;
    height:100%;
    z-index:-1;

}
-->
</style>
</head>

<body onload="move()">
<div id="apDiv1" onmouseover="stopTimer()" onmouseout="move()"><img src="../jsImage/2011022516043389.gif" id="img1" /><button onclick="close1()" id="button1">关闭</button></div>
<button onclick="ajax1()">获取数据</button><br />
<div id="myDiv">
Ajax
</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值