注册 登录
编程论坛 JavaScript论坛

浮动图片不随滚动条移动---求助

jianghong_02 发布于 2010-12-02 16:38, 868 次点击
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>浮动窗口</title>
<script language="javascript" type="text/php">
var adv=0;
function Move(){
document.getElementById("radvLaye").style.pixelTop=adv+document.body.scrollTop;
}
window.onscroll=Move;
</script>
</head>

<body>
<div id="radvLaye" style="position:absolute;
    left:16px;
    top:129px;
    width:180px;
    height:230px;
    z-index:1;
    visibility: visible;"><img src="hero.gif" width="180" height="230" /></div>
    <p>&nbsp;</p>
<img src="menu.jpg" width="1024" height="1799" />
<p>&nbsp;</p>
</body>
</html>
2 回复
#2
aspic2010-12-03 15:09
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>浮动窗口</title>
<script>
var adv=0;
function Move(){
    document.getElementById("radvLaye").style.top=document.documentElement.scrollTop + 150 + 'px';
}
window.onscroll=Move;
</script>
</head>

<body style="height:9999px">
    <div id="radvLaye" style="position:absolute;left:16px;top:129px;width:180px;height:230px;z-index:1">fdafdsafdsafdsa</div>
</body>
</html>
<script language="javascript" type="text/php">
你这段不是搞笑吧?
#3
jianghong_022010-12-03 17:24
哈哈…………好像就是个搞笑,不我本人发的啦…………
1