Hey all, learning JS and trying to take this script I found that was intended to be included in the head and convert it to an external js.
It is a slideshow script, however I want to use it as an external because I have multiple pages for a portfolio in which I want to have the slideshow and have them use this script.
Problem with the script is that you need to define the values of the array in the script so I am trying to change it so I can define them in the HTML file and then send them to the external js.
external JS
var photos=new Array()
function assignphoto(x,imval){
photos[x]=imval;
return photos[x];
}
HTML
<script type="text/javascript" src="slideshow.js">
//<![CDATA[
assignphoto(0,"images/portfolio/amputee/amp001.jpg");
assignphoto(1,"images/portfolio/amputee/amp002.jpg");
//]]>
</script>
to me this should work because the function receives the array position and the string.
I have tried it multiple ways, assigning a separate var s in the html and doing stuff there to send it.
Is there a better way to define and or retrieve the value I want for the array positions?
I’ve seen some examples that use the document.getElementById() but I’m new and unsure how I would define the value in both the HTML and external JS.
link to orig js from dynamicdrive http://www.dynamicdrive.com/dynamicindex14/dhtmlslide.htm
THX