Click to See Complete Forum and Search --> : javascript not working without a page refresh


mickeroo
09-23-2003, 11:37 AM
Hi there,

I've been working on a page to display images that combines php and javascript (trying to learn both) to read the images from a folder, display them in a grid and pops a larger version into a new window when the person clicks on it. This is nothing new, I'm sure!

here's the page:
http://www.mickeroo.com/nygallery.php

The page has 20 named images and hrefs and if there are more than 20 pics to be displayed, there is navigation at the top and bottom to go to the next/previous page. Pretty standard stuff.

The problem I'm having is that sometimes when I open a browser window and go to the page, the javascript works perfectly. Other times I have to do a ctrl-reload before I can use the navigation or click an image to have the popup work. I've had some friends try with their systems and got similar results. The javascript nav and popups always seems to work after a control-refresh but I don't want to have to rely on visitors doing that. Any ideas?

Thanks in advance!
Mike E.

requestcode
09-23-2003, 12:24 PM
It worked for me when I went to the page. I was able to navigate to the next document. A few images did not display, but that could be a separate issue. How are you placing the JavaScript on the page? Are you using PHP to write the script, in other words are you using PHP to create the whole document or only the parts that contain the images. If PHP is writing out the script maybe it is not completing the process. Are you getting any errors? Also you might try posting this in the PHP section. Possibly someone there has had the same problem.

mickeroo
09-23-2003, 01:04 PM
Thanks for taking a look!

I'm using PHP to read a directory and load a javascript array with the filenames to be displayed. I also use PHP to do the work of cranking out the html for the 20 images (so I can change the quantity of pics and dimensions of the grid easily).

Comparing the html source (by doing a view source on the page) from when it works to when it doesn't hasn't revealed any differences- so it looks like PHP is cranking out the same code each time. I could post the whole source code for the file if you think that would be of any help...
me

mickeroo
09-23-2003, 01:07 PM
oh, I forgot... as for errors:

No javascript errors (have only tested in IE6, NS7, & Opera). Also no PHP errors either.
me