---
title: "Bild.."
type: "forum-thread"
url: "https://www.webforum.nu/amne/javascript/18668-bild"
topic: "JavaScript"
topic_url: "https://www.webforum.nu/amne/javascript"
author: "JonasT"
published: "2001-12-29T17:56:00.000Z"
updated: "2001-12-29T19:21:00.000Z"
replies: 1
views: 167
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/javascript/18668-bild"
---

# Bild..

## #1 — JonasT, 2001-12-29T17:56Z

Hej!
Jag undrar om det finns ngt script som gör att en bild kommer in från vänstra sidan av skärmen och åker (som marquee) över skärmen. Och ut på högrasidan. Och det ska inte uprepas..den ska bara åka så en gång...

Permalänk: https://www.webforum.nu/p/18668

## #2 — Jojoxx, 2001-12-29T19:21Z

Exempel;

```
<div id="foo" style="position:absolute;left:-50px;top:100px;">En_bild</div>
<script type="text/javascript" language="JavaScript">
xpos=-50; ypos=100; speed=10; delay=50;
function runMeMany(){
	xpos+=speed;
	moveLayerAbs('foo',xpos,ypos);
	(xpos<getClientWidth())?setTimeout('runMeMany()',delay):hideLayer('foo');
}
function moveLayerAbs(Id,x,y){
	if (document.all){
		if (x) document.all[Id].style.left = x;
		if (y) document.all[Id].style.top = y;
	} else if (document.layers){
		if (x) document.layers[Id].left = x;
		if (y) document.layers[Id].top = y;
	} else if (document.getElementById){
		if (x) document.getElementById(Id).style.left = x+'px';
		if (y) document.getElementById(Id).style.top = y+'px';
	}
}
function hideLayer(Id){
	if (document.all) {
		document.all[Id].style.visibility = "hidden";
	} else if (document.layers){
		document.layers[Id].visibility = "hide";
	} else if (document.getElementById){
		document.getElementById(Id).style.visibility = "hidden";
	}
}
function getClientWidth(){
		return (document.all)?document.body.clientWidth:window.innerWidth;
}
</script>
```

startas enklast från \<body\> med **onload="runMeMany()"**

Permalänk: https://www.webforum.nu/p/335823

---

Tråden på webben: https://www.webforum.nu/amne/javascript/18668-bild
