图片不能动? 我初学的,不明白你的意思。var windowwidth = document.bidy.clientWidth-document.getElementById('Layer1').style.width; ----- bidy??????? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 错了 是BODY可是这么一改整个页面到不了头了 document.getElementById('Layer1').style.height; document.getElementById('Layer1').style.width;读不到的可以用:document.getElementById('Layer1').offsetHeightdocument.getElementById('Layer1').offsetWidth;<script> function move(){var height = document.body.clientHeight-document.getElementById('Layer1').offsetHeight; var windowwidth = document.body.clientWidth-document.getElementById('Layer1').offsetWidth; document.getElementById('Layer1').style.pixelTop=document.body.scrollTop+height; document.getElementById('Layer1').style.pixelLeft=document.body.scrollLeft+windowwidth; } window.onscroll=move; </script> <style type="text/css"> <!-- #Layer1 { position:absolute; width:140px; height:93px; z-index:1; right:0px; bottom:0px; background: url(1111.jpg) #f00; } --> </style> </head> <body> <img src="011.jpg" height=9999> <img src="011.jpg"> <div id="Layer1"> </div> </body> 或用:document.getElementById('Layer1').currentStyle.heightdocument.getElementById('Layer1').currentStyle.width)<script> function move(){var height = document.body.clientHeight-parseInt(document.getElementById('Layer1').style.height||document.getElementById('Layer1').currentStyle.height); var windowwidth = document.body.clientWidth-parseInt(document.getElementById('Layer1').style.width||document.getElementById('Layer1').currentStyle.width); document.getElementById('Layer1').style.pixelTop=document.body.scrollTop+height; document.getElementById('Layer1').style.pixelLeft=document.body.scrollLeft+windowwidth; } window.onscroll=move; </script> <style type="text/css"> <!-- #Layer1 { position:absolute; width:140px; height:93px; z-index:1; right:0px; bottom:0px; background: url(1111.jpg) #f00; } --> </style> </head> <body> <img src="011.jpg"height=9999> <img src="011.jpg"> <div id="Layer1" style=""> </div> </body> 用js得到datagrid中的字段值? ext ext.data.store 中参数问题 Ext中怎么让grid控件中指定谋行数据让它变成灰色,不可用的状态 ie&firefox弹出窗口问题 拉动条控制层的透明度例子 请问谁有FB3_WWEJ.exe插件 关于proxy的写法 高手答疑:为何这个js会出错? 在tr上点击右键,触发一段javascript怎么写 jquery 部分屏蔽浏览器右击菜单问题 怎样使用JavaScript定义不规则图形 来帮忙看一下,为什么出错
可是这么一改整个页面到不了头了
document.getElementById('Layer1').style.width;
读不到的
可以用:
document.getElementById('Layer1').offsetHeight
document.getElementById('Layer1').offsetWidth;<script>
function move(){
var height = document.body.clientHeight-document.getElementById('Layer1').offsetHeight;
var windowwidth = document.body.clientWidth-document.getElementById('Layer1').offsetWidth;
document.getElementById('Layer1').style.pixelTop=document.body.scrollTop+height;
document.getElementById('Layer1').style.pixelLeft=document.body.scrollLeft+windowwidth;
} window.onscroll=move;
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:140px;
height:93px;
z-index:1;
right:0px;
bottom:0px;
background: url(1111.jpg) #f00;
}
-->
</style>
</head> <body>
<img src="011.jpg" height=9999>
<img src="011.jpg">
<div id="Layer1"> </div>
</body>
document.getElementById('Layer1').currentStyle.height
document.getElementById('Layer1').currentStyle.width)<script>
function move(){
var height = document.body.clientHeight-parseInt(document.getElementById('Layer1').style.height||document.getElementById('Layer1').currentStyle.height);
var windowwidth = document.body.clientWidth-parseInt(document.getElementById('Layer1').style.width||document.getElementById('Layer1').currentStyle.width);
document.getElementById('Layer1').style.pixelTop=document.body.scrollTop+height;
document.getElementById('Layer1').style.pixelLeft=document.body.scrollLeft+windowwidth;
} window.onscroll=move;
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:140px;
height:93px;
z-index:1;
right:0px;
bottom:0px;
background: url(1111.jpg) #f00;
}
-->
</style>
</head> <body>
<img src="011.jpg"height=9999>
<img src="011.jpg">
<div id="Layer1" style=""> </div>
</body>