Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] PHP

Started by Tipotas688 Jun 8, 2010 at 11:04 AM 10 replies 1.3k views
Original Post
Tipotas688
Tipotas688
I get some weird behaviour with my php dynamic gallery.

It reads a folder, and presents the pictures inside it. But when I click on a picture and the popup window appears, the page returns to its topmost scrollable point. How do I keep the page to where it is?
dustin10
dustin10
Just a guess, but it sounds like you are using "#" as the href attribute for the a tag and then using &#106avascript to popup the larger image. Try putting "return false;" at the end of your onclick function. That way it wont actually try to find the anchor.
rhnz
rhnz
Enter an empty location.
Evil Steve
Evil Steve
Quote:
Original post by Tipotas688
*** Source Snippet Removed ***

still the same :S
I'm pretty sure you need the double quotes (See my above post), otherwise how is the browser to know that the "return false;" is associated with the onClick handler?
Wan
Wan
You haven't escaped your single quotes

onclick='window.open('popup.php?....');return false'                     ^              ^
Try
print "";

Evil Steve
Evil Steve
Quote:
Original post by Tipotas688
its part of php so its like this as a whole:

*** Source Snippet Removed ***
Then it's wrong :P

You need to print out the double quotes, otherwise it won't work - PHP won't auto-insert them for you.

EDIT: What Wan said
Tipotas688
Tipotas688
ah finally it worked, thanks a bunch, before this post I had the return false in 10 different places and none worked just because I thought to have everything with '' instead of \" just for clarity... thanks again!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.