Michael: PHP-Array in Javascript-Array umwandeln

Beitrag lesen

Hallo Axel,

Sorry, ist logisch :o)

Bitte, hier der Code, der für die Ausgabe der Bilder verantwortlich ist (einen Link gibt es noch nicht, da ich die Homepage zur Zeit noch auf meinem Rechner entwerfe):

<script language="javascript" type="text/javascript">
  <!--
    <?php echo "jsArr = new Array();\r\n";

foreach ($Bilder as $Schluessel => $Inhalt)
        echo "jsArr[{$Schluessel}] = "{$Inhalt}";\r\n";

?>

var sliderwidth= '100%'
    var sliderheight = '100%'
    var slidespeed = 3

var leftrightslide = new Array();
    var finalslide = '';

for (i = 0; i < jsArr.length; i++)
    {
      finalslide=finalslide+'<img src="' + jsArr [i] + '">';
      finalslide=finalslide+'<img src="pic/gfx/L_spacer.gif" width="5" height="1">';
    }

var copyspeed=slidespeed

if (document.all)
    {
      document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
      ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
      ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
    }

function regenerate()
    {
      window.location.reload()
    }

function regenerate2()
    {
      if (document.layers)
      {
        document.ns_slider01.visibility="show"
        setTimeout("window.onresize=regenerate",450)
        intializeleftrightslide()
      }

if (document.all)
        ieslider.scrollAmount=slidespeed
    }

function intializeleftrightslide()
    {
      document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
      document. ns_slider01.document.ns_slider02.document.close()
      thelength=document.ns_slider01.document.ns_slider02.document.width
      scrollslide()
    }

function scrollslide()
    {
      if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1))
      {
        document.ns_slider01.document.ns_slider02.left-=slidespeed
        setTimeout("scrollslide()",100)
      }
      else
      {
        document.ns_slider01.document.ns_slider02.left=sliderwidth
        scrollslide()
      }
    }

window.onload=regenerate2
  //-->
</script>
<ilayer width=&{sliderwidth}; height=&{sliderheight}; name="ns_slider01" visibility=hide>
  <layer name="ns_slider02" onMouseover="slidespeed=0;" onMouseout="slidespeed=copyspeed"></layer>
</ilayer>

Gruss, Michael