Dzint Posted February 3, 2008 Report Posted February 3, 2008 (edited) Ar php tiek izveidots masivs, piemera parast masivs, domāts ka dati nāks no mysql datubazes <? $pict = array("23.jpg", "24.jpg", "26.jpg", "2.jpg", "30.jpg", "32.jpg", "36.jpg", "38.jpg"); ?> Masivs tiks apstradats ar JavaScript. Bet nezinu ka lai JavaScript rez šo masīvu <script language="JavaScript"> var pic = new Array(); // Šeit man vajadzētu šo php $pict masīvu function def_masivu() { // Un šeit arī man vajadzētu dabūt šo php $pict masīvu } function myimage(pic) { document.images['pic'].src = pic; } function myimages() { pic.shift(); if (pic.length<1) { def_masivu() ; } document.pic.src = pic[0]; } </script> Script domats attēlu paradišanai, kas visu laiku iet uz riņķi. Edited February 3, 2008 by Dzint
andrisp Posted February 3, 2008 Report Posted February 3, 2008 foreach($pict as $k => $v) { echo 'pic['.$k'] = "'.$v.'";'."\n"; } Kaut kā ta.
ViszinisA Posted February 3, 2008 Report Posted February 3, 2008 (edited) echo "var pic = new Array(\"".implode("\",\"",$pict)."\");"; var mycars=new Array("Saab","Volvo","BMW"); peec shii piemeera no w3schooliem Tas iekš php koda wow Edited February 3, 2008 by ViszinisA
andrisp Posted February 3, 2008 Report Posted February 3, 2008 Dzint, jā, tas ir php kods, kas izdrukā JS kodu.
Dzint Posted February 3, 2008 Author Report Posted February 3, 2008 Paldies, ar šo masīvu sanāca. Nezinu ka bus ar datiem no mysql datubazes.
Recommended Posts