Forum Moderators: open

Message Too Old, No Replies

Javascript slideshow not working in php pages

slideshow not working

         

judson

4:54 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



I have a javascript slideshow, code:

function SlideShow(increment){

// Name the images in the directory from which it is fetched as "1.jpg","2.jpg" etc then use the following code directly
// read "README.TXT" for more information

var dir="images";//Name of the directory from where images are picked
var limit=5;//Maxmimum number of images in the directory.This means you have 5 images in the directory and the last image name is "5.jpg"

if(increment>0 && increment<limit+1 ){

document.img.src=dir+"/"+increment+".jpg";
document.forms[0].increment.value=increment

}

}

And I get this error message when I click the next button:

error: 'document.forms.0.increment.value' is null or not an object

I made a page with just the javascript and the form and it works fine, but not when I put it in my php page. I put a link to a js file in my header.html file and included the slideshow.html in my php pages, but non of that worked. Do I need to load something in the body tag?

StupidScript

6:34 pm on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error message you are receiving indicates that the first form on your page does not contain an element named "increment".

Perhaps your PHP page has another form that is in position to be the first form on the page? Have you tried

forms[1]
and so on?

judson

10:00 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



That must be it, as I have a login script at the top. I have already moved on, but thanks for the help!