<html>
<head>
<title></title>
<script>
function show1(){
var mydiv=document.getElementById("mydiv");
mydiv.innerText+='单击';
}
function show2(){
var mydiv=document.getElementById("mydiv");
mydiv.innerHTML+='按下';
}
this.οnscrοll=function(){//this就是指文档document,所以此处this可改为document
var mydiv=document.getElementById("mydiv");
mydiv.innerHTML+='我滚啊滚...'+document.body.scrollTop;
var adv=document.getElementById("adv");
adv.style.pixelTop=30+document.body.scrollTop;
}
</script>
<style>
#adv{
position:absolute;
width : 200px ;
height : 115px ;
z-index : 1 ;
left : 108px ;
top : 73px ;
}
</style>
</head>
<body>
<input type="button" value="请点击这里" οnclick="show1()" οnmοusedοwn="show2()"/>
<div id="mydiv" style="height:2000;background-color:pink"></div>
<div id="adv">xxxx</div>
</body>
</html>
<head>
<title></title>
<script>
function show1(){
var mydiv=document.getElementById("mydiv");
mydiv.innerText+='单击';
}
function show2(){
var mydiv=document.getElementById("mydiv");
mydiv.innerHTML+='按下';
}
this.οnscrοll=function(){//this就是指文档document,所以此处this可改为document
var mydiv=document.getElementById("mydiv");
mydiv.innerHTML+='我滚啊滚...'+document.body.scrollTop;
var adv=document.getElementById("adv");
adv.style.pixelTop=30+document.body.scrollTop;
}
</script>
<style>
#adv{
position:absolute;
width : 200px ;
height : 115px ;
z-index : 1 ;
left : 108px ;
top : 73px ;
}
</style>
</head>
<body>
<input type="button" value="请点击这里" οnclick="show1()" οnmοusedοwn="show2()"/>
<div id="mydiv" style="height:2000;background-color:pink"></div>
<div id="adv">xxxx</div>
</body>
</html>