javascript
html标签始终在右下角,html+javascript实现图片始终在页面右下角
function setVariables() {
imgwidth=235; //圖像的寬度
imgheight=19; //圖像的高度
if (navigator.appName == "Netscape") { //netscape下的位置設置
horz=".left";
vert=".top";
docStyle="document.";
styleDoc="";
innerW="window.innerWidth";
innerH="window.innerHeight";
offsetX="window.pageXOffset";
offsetY="window.pageYOffset";
}
else { //ie下的位置設置
horz=".pixelLeft";
vert=".pixelTop";
docStyle="";
styleDoc=".style";
innerW="document.body.clientWidth";
innerH="document.body.clientHeight";
offsetX="document.body.scrollLeft";
offsetY="document.body.scrollTop";
}
}
function checkLocation()
{
objectXY="rightBottom"; //獲取始終顯示在右下角的div
var availableX=eval(innerW); //最大x坐標
var availableY=eval(innerH); //最大y坐標
var currentX=eval(offsetX); //鼠標當前的x坐標
var currentY=eval(offsetY); //鼠標當前的y坐標
x=availableX-(imgwidth+30)+currentX; //最終div的x坐標
y=availableY-(imgheight+20)+currentY;//最終div的y坐標
evalMove();
setTimeout("checkLocation()",10); //定時移動
}
function evalMove() { //移動到指定位置
eval(docStyle + objectXY + styleDoc + horz + "=" + x);
eval(docStyle + objectXY + styleDoc + vert + "=" + y);
}
aaa
aaa
aaa
aaa
aaa
aaa
aa
a
aa
a
a
a
a
總結
以上是生活随笔為你收集整理的html标签始终在右下角,html+javascript实现图片始终在页面右下角的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Leetcode--304. 二维区域和
- 下一篇: Leetcode--994. 腐烂的橘子