Hej, Tja, du kan ju kolla detta så! Sedan kan man ju också köra med marquee i en tabell eller direkt på sidan.Lite scripthjälp (javascript)
jag skulle behöva lite hjälp med en rullande bildremsa bestående av låt säga 5-9 st bilder med höjden 70px...
detta rör sig altså om en automatiskt rullande bildremsa som skall placeras på framsidan av min sida.
det vore jätte snällt om jag skulle kunna få lite hjälp av er lite kunnigare ;)Sv: Lite scripthjälp (javascript)
<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="FFFFFF">
<div id="Layer1" style="position:absolute; left:10%; top:2%; width:50%; visibility: visible;">
<script language="JavaScript1.2">
var sliderwidth="600px"
var sliderheight="80px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=5
//configure background color:
var slidebgcolor=""
//Specify the slider's images
var leftrightslide=new Array()
leftrightslide[0]='<img src="bild1.jpg" height="70" width="70" border=2>'
leftrightslide[1]='<img src="bild2.jpg" height="70" width="70" border=2>'
leftrightslide[2]='<img src="bild3.jpg" height="70" width="70" border=2>'
leftrightslide[3]='<img src="bild4.jpg" height="70" width="70" border=2>'
leftrightslide[4]='<img src="bild5.jpg" height="70" width="70" border=2>'
leftrightslide[5]='<img src="bild6.jpg" height="70" width="70" border=2>'
leftrightslide[6]='<img src="bild7.jpg" height="70" width="70" border=2>'
leftrightslide[7]='<img src="bild8.jpg" height="70" width="70" border=2>'
////NO EDIT BELOW ////////////
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join("")+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:0px;left:0px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+0+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+10
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",10)
}
window.onload=fillup
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+10))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+10+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+10))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+10+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+10
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+10
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-800px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0</layer>')
write('<layer name="ns_slidemenu3" left=0 top=0</layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
</div></body>
</html>
</code>Sv: Lite scripthjälp (javascript)
Vill man inte ha den i tabellen så lägg bara in marquee direkt efter body-taggen.
Har gjort ett litet exempel här.
<html>
<head>
<style type=text/css>
body {background-color:lightgreen}
table {width:300; height:75; background-color:green; border 1px solid blue;}
</style>
</head>
<body>
<table>
<tr>
<td>
<marquee>
<img src="bild1.jpg" height="70" width="70" border=2>
<img src="bild2.jpg" height="70" width="70" border=2>
<img src="bild3.jpg" height="70" width="70" border=2>
<img src="bild4.jpg" height="70" width="70" border=2>
<img src="bild5.jpg" height="70" width="70" border=2>
<img src="bild6.jpg" height="70" width="70" border=2>
<img src="bild7.jpg" height="70" width="70" border=2>
<img src="bild8.jpg" height="70" width="70" border=2>
</marquee>
</td>
</tr>
</table>
</body>
</html>