Hi NG. I'm having some trouble parsing a php array to a javascript function. I've searched the web and found that others before me have had the same problem, but I haven't been able to find a solution to my problem yet.
simple function example: "tal" is a php array and "count" is the size of that array. The array "tal" and the var "count" has of cause been assigned values prior to calling preload_images($tal, $count); ---------------------------------- <script language=javascript> function preload_images(tal, count) { var pics = new Array(count); for (i = 0; i < count; i++) { var pic = new Image(); pic.src = 'nef/graphic/ball_' + tal[i] + '.gif'; pics[i] = pic; document.write(pic.src + '<br>'); } } </script> ---------------------------------- The idea was just to pick up the images in the new array "pics" to make sure the images were preloaded. But I added the "document.write" statement to check the value of the image path. The result is as follows for sizeof($tal) = 14: ------------------------------- http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif http://localhost/nef/graphic/ball_undefined.gif -------------------------------- So my php array seems to have no values once in the javascript function. How can I fix this? Please help... /Aidal -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php