javascript高手请进哈帮忙小弟一个问题了~我才开始学习这门课程有些难度
下面是我的代码显示信息就是第九行第三个字符出现了错误我的主题就是在网页加载的时候有一个用层构造的广告能够随着滚动条移动...functionxx(){name.style...
下面是我的代码 显示信息就是第九行第三个字符出现了错误
我的主题就是在网页加载的时候有一个 用层构造的广告能够随着滚动条移动...
function xx()
{
name.style.top=document.body.Scrolltop+document.body.clientHeight-150
name.style.left=document.body.Scrollleft+document.body.clientWidth-200
setTimeout("xx()",70)
}
</script>
<style type="text/css">
<!--
#name {
position:absolute;
left:608px;
top:256px;
width:64px;
height:75px;
z-index:1;
}
-->
</style>
</head>
<body onload="xx()">
<div id="name"><img src="daoying.jpg" width="450" height="299" /></div> 展开
我的主题就是在网页加载的时候有一个 用层构造的广告能够随着滚动条移动...
function xx()
{
name.style.top=document.body.Scrolltop+document.body.clientHeight-150
name.style.left=document.body.Scrollleft+document.body.clientWidth-200
setTimeout("xx()",70)
}
</script>
<style type="text/css">
<!--
#name {
position:absolute;
left:608px;
top:256px;
width:64px;
height:75px;
z-index:1;
}
-->
</style>
</head>
<body onload="xx()">
<div id="name"><img src="daoying.jpg" width="450" height="299" /></div> 展开
1个回答
展开全部
<script type="text/javascript">
<!--
lastScrollY = 0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("picDiv").style.top = parseInt(document.getElementById("picDiv").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
window.setInterval("heartBeat()",1);
//-->
</script>
<!--
#picDiv {
position:absolute;
width:64px;
height:75px;
z-index:1;
}
-->
</style>
</head>
<body>
<div id="picDiv" style="top:256px;left:608px;"><img src="daoying.jpg" width="450" height="299" /></div>
<!--
lastScrollY = 0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("picDiv").style.top = parseInt(document.getElementById("picDiv").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
window.setInterval("heartBeat()",1);
//-->
</script>
<!--
#picDiv {
position:absolute;
width:64px;
height:75px;
z-index:1;
}
-->
</style>
</head>
<body>
<div id="picDiv" style="top:256px;left:608px;"><img src="daoying.jpg" width="450" height="299" /></div>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询