I am trying to create a simple slideshow to learn javascript and a small amount of PHP. People are meant to simply upload a photo to their site using for example Filezilla. The website should automaticly take the photo into the slideshow.
I am still very novice though.
So far I got:
+ PHP to read the file names in the folder.
+ Javascript to take over the PHP Array.
That is not much.. but I already run into a mistake in the next part.
<script> var SlideShow = ["<?php echo join("", "", $PhotoSlide); ?>"]; var SSl=SlideShow.length - 1; var picture = "'../photos/" + SlideShow[0] + "'" document.getElementById("backgroundswitch").style.backgroundImage = "url(picture)";</script>
Now somehow, it doesn't actually change the background. Whilst the variable picture is really '../photos/PHOTONAME.jpg' when I use an Alert to test it.
JS/PHP slideshow basics don't work.
in JavaScript
Posted · Edited by Rudovich
Hello everyone,
I am trying to create a simple slideshow to learn javascript and a small amount of PHP. People are meant to simply upload a photo to their site using for example Filezilla. The website should automaticly take the photo into the slideshow.
I am still very novice though.
So far I got:
+ PHP to read the file names in the folder.
+ Javascript to take over the PHP Array.
That is not much.. but I already run into a mistake in the next part.
Now somehow, it doesn't actually change the background. Whilst the variable picture is really '../photos/PHOTONAME.jpg' when I use an Alert to test it.
Edit: Thank you in advance