关于层的问题!

Lihaitao312 2003-08-04 04:27:01
在很多网站上面可以看到一个图标在页面上移动,我感觉很好奇,希望有这样的代码的朋友能提供给我参考。谢谢!
...全文
28 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Lihaitao312 2003-08-04
  • 打赏
  • 举报
回复
Brookes(边走边唱) :由于有你的代码作为参谋,我的问题已经自己解决了,所以我还是要谢谢热心的人。
Lihaitao312 2003-08-04
  • 打赏
  • 举报
回复
Brookes(边走边唱) :你提供的代码试随着滚动条移动,那个层的位置依然在屏幕的固定位置。我想的是如何处理让那个层自动的在屏幕上面移动。
Lihaitao312 2003-08-04
  • 打赏
  • 举报
回复
Brookes(边走边唱) :你好,你的代码我试了一下,它仅仅只是一个图标(层)在页面上显示,但是没有见到它如何移动,虽然你实际了一个停留的时间,但是没有什么作用?
Brookes 2003-08-04
  • 打赏
  • 举报
回复
参考:
var imgheight
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=120
function myload()
{
if (navigator.appName == "Netscape")
{document.chip1.pageY=pageYOffset+window.innerHeight-imgheight;
document.chip1.pageX=+window.innerWidth*0.72;
mymove();
}
else
{
chip1.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
chip1.style.left=document.body.offsetWidth*0.72;
mymove();
}
}
function mymove()
{
if(document.ns)
{
document.chip1.top=pageYOffset+window.innerHeight-imgheight;
document.chip1.left=pageXOffset+window.innerWidth*0.72;
setTimeout("mymove();",80)
}
else
{
chip1.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
chip1.style.left=document.body.scrollLeft+document.body.offsetWidth*0.72;
setTimeout("mymove();",80)
}
}

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

if (navigator.appName == "Netscape")
{document.write("<layer id=chip1 top=300 width=80 height=88><a href=xxx.asp target=_blank><img src=2.jpg width=80 height=80 border=0></a></layer>");
myload();}
else
{
document.write("<div id=chip1 style='position: absolute;width:80;top:0;left:578;visibility: visible;z-index: 1'><a href=xxx.asp target=_blank><img src=2.jpg border=0></a></div>");
myload();
}
Lihaitao312 2003-08-04
  • 打赏
  • 举报
回复
如果是思路和方法,同样感谢!我现在是什么思路都没有。

87,988

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧