标签:style java ext javascript width get
源代码:
<html >
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=gb2312" />
<title>增加节点</title>
<style type="text/css">
</style>
</head>
<body>
<div id="layer1"
style="background: url(imag/3.jpg) no-repeat;height: 288px;width:
192px;position: absolute;left: 100px;top: 50px;">
<div
style="height: 13px;width: 13px;position: absolute;right:
0px"></div>
</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<script type="text/javascript">
var x = 50, y = 60;
var
xin = true, yin = true;
var step = 1;
var delay = 10;
function floatAD(){
var L = T = 0;
var R =
document.documentElement.offsetWidth -
document.getElementById("layer1").offsetWidth;
var B =
document.documentElement.offsetHeight -
document.getElementById("layer1").offsetHeight;
document.getElementById("layer1").style.left = x;
document.getElementById("layer1").style.top = y;
x = x + step * (xin
? 1 : -1);
if (x < L) {
xin = true;
x = L;
}
if (x > R) {
xin = false;
x = R;
}
y = y + step * (yin ? 1 : -1)
if (y < T) {
yin = true;
y = T;
}
if (y > B) {
yin = false;
y =
B;
}
setTimeout("floatAD()", delay)
}
window.onload=floatAD;
</script>
</body>
</html>
标签:style java ext javascript width get
原文地址:http://www.cnblogs.com/fg19/p/3705227.html