Page 1 of 1

File isn't being found in directory

Posted: Tue Mar 06, 2007 8:16 pm
by snowrhythm
hello...i've got a simple JS script that opens a picture in a new window. it's passed the directory path to the picture and every time
the path comes up correctly but it can't find the file...and the file is DEFINITELY there. anyone have any clue why it comes up "Not Found"?

Code: Select all


  function OpenPic(urlForPic){
      window.open(urlForPic, '', 'width=auto, height=auto, scrollbars=0, toolbar=0');
  }

Code: Select all

function QueryExec($sql){

      if(!empty($sql)){

        $query = mysql_query($sql);

        while($qryResults = mysql_fetch_array($query)){

          $theLink[] = $qryResults['photo_name'];

        }

        echo '<h5 class="picTitle">'.$_GET['cat'].'&nbsp;&nbsp;Photos</h5>';

        echo '<div class="thumbWrap">';

        foreach($theLink as $link){

          echo '<div class="picCell" id="http://localhost/Freelance%20Work/Ashland/2007/images/'.$link.'" onclick="OpenPic(this.id)">pic</div>';

        }          

      } else {

        return false;

      }

    }

Posted: Tue Mar 06, 2007 9:25 pm
by hawleyjr
What are the file/directory permissions?

Posted: Tue Mar 06, 2007 11:25 pm
by Kieran Huggins
8O that is a terrible use of the ID attribute...why not just hard-code the URL into the onclick function itself?

Posted: Wed Mar 07, 2007 9:36 am
by snowrhythm
the file permissions are totally fine...i'm using the ID attribute because I
want more control over the window that i'm opening. eventually i'll be
using LightBox, but until then this was the only way (i thought) i could
spec the window how i wanted it. Am i wrong? can i have control over
the new window without using js?

Posted: Wed Mar 07, 2007 10:06 am
by Xoligy
Change:
id="http://localhost/Freelance%20Work/Ashla ... es/'.$link.'" onclick="OpenPic(this.id)"

To:

onclick="OpenPic(\'http://localhost/Freelance%20Work/Ashla ... es/'.$link.'\');"

Makes much more sense. It will probably fix your problem too.

Posted: Wed Mar 07, 2007 10:09 am
by nickvd
Just install and use lightbox right now... Include the javascript/css files, add a class to your images and wham! You're done!

Posted: Wed Mar 07, 2007 11:15 am
by snowrhythm
hey thanks alot guys....I can't really try that stuff yet because i'm at work and that code is for a freelance
project at home. but i'll check it out first thing tonight and let you know how it turns out. right before i
go see 300!

Posted: Wed Mar 07, 2007 12:58 pm
by nickvd
snowrhythm wrote:right before i
go see 300!
If you expect any further help of this matter, you will be required to submit an review of the movie ;)

Posted: Wed Mar 07, 2007 6:33 pm
by snowrhythm
lol....right on, except i'm all depressed now because I forgot that it comes out on the 9th and not tonight :(

Posted: Thu Mar 08, 2007 10:18 am
by snowrhythm
alright, i got lightbox installed and everything is working great. thanks for the help guys.