I have a slider that uses an html file in a frame on SharePoint. Slides are changed quite frequently and this slider is being rolled out 10 more times. I am wanting to create a workflow so the end user can change the slider/href themselves. I have created the function below which dynamically creates my "li" and "a" and is working. Eventually I will use variables to get the "src" etc.
My question is I would like to do a "for each" to run through a specified directory and grab the file names so I can create a new "li" and "a" for each file and pull in my "src" for the "a" dynamically also.
If I did not say this correctly I apologize. I am a newbie to JavaScript and programming in general. I have spent quite a bit of time trying to figure this out myself. Any assistance/explanation/direction would be greatly appreciated.
<!DOCTYPE html>
<html>
<head></head>
<body>
<script>
document.body.onload = addElement;
function addElement() {
//run through a directory and grab URLs
// create a new li element
var newLi = document.createElement("li");
//create img
var newImg = document.createElement("img");
newImg.setAttribute("src", "Intranet_643x296.jpg");
newImg.setAttribute("height", "100%");
newImg.setAttribute("border-radius", "10px");
newImg.setAttribute("alt", "Einstein");
// Set its contents:
document.getElementById("ulimage").appendChild(newImg);
}
</script>
<ul id="ulimage"></ul>
</body>
</html>