Bild automatisch bewegen...
Manuel
- javascript
Hallo,
warum funktioniert folgendes Script nicht?:
<html>
<head>
<script type="text/javascript">
<!--
function Wandern() {
document.all.decke.style.top+=1;
document.all.decke.style.left-=2;
}
window.setInterval("Wandern()",50);
//-->
</script>
</head>
<body onLoad="javascript: Wandern();">
<div id="boden" style="position: absolute; top: 0; left: 0; width: 0; height: 0;"><img src="boden.gif"></div>
<div id="decke" style="position: absolute; top: 100; left: -250; width: 0; height: 0;"><img src="decke.gif"></div>
</body>
</html>
Danke für die Hilfe
abend,
folgendes script ist im IE lauffähig und bewegt den div...:
<html>
<head>
<script type="text/javascript">
window.setInterval("Wandern()",50);
function Wandern() {
xAdd = 10;
curTopPx = document.getElementById("decke").style.top;
curTop = curTopPx.substr(0,curTopPx.length-2);
xnewTop = ((curTop*1) + (xAdd*1));
xnewTopPx = xnewTop + "px";
yAdd = 10;
curLeftPx = document.getElementById("decke").style.left;
curLeft = curLeftPx.substr(0,curLeftPx.length-2);
ynewTop = ((curLeft*1) + (yAdd*1));
ynewTopPx = ynewTop + "px";
document.getElementById("decke").style.top = xnewTopPx;
document.getElementById("decke").style.left = ynewTopPx;
}
</script>
</head>
<body>
<div id="decke" style="position: absolute; top: 100; left: 250; width: 0; height: 0;">
MOTIONLESS?</div>
</body>
</html>
HIH
mfg,
(tanz das)
Z.N.S.
hi,
warum funktioniert folgendes Script nicht?:
warum sagst du uns nicht, was "funktioniert nicht" bedeutet?
lies bitte mal </faq/#Q-07b>, bevor du die nächste frage hier stellst.
gruss,
wahsaga