×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

PHP and Popup windows

How do I make a link open a popup window? by JustKIDn
Posted: 11 Nov 03

I needed a way to make a photo display script show a photo when clicked in a new window. I didn't write the original photo display script myself but I did modify it. Including adding the popup window effect.

This is what I started with:
echo "<td align=center><a href=\"$images[$i]\">$images[$i]<BR><BR><img border=0 src=\"thumbs/$thumb[$i]\"></a><BR><BR></td>";


This example would only open the image in the same browser window. So then I would have to hit the back button to return and then wait for all the pictures to be redrawn again.

I was concerned about using javascript because of the possibilities of errors.

I got most of my help from this page;
http://youngpup.net/_ui_webapp/getFrames.asp?request=/a...

This is what I came up with:
   echo "<td align=center><a href=\"$images[$i]\" onclick=\"window.open(this.href, 'popupwindow', 'height=500,width=655,scrollbars,resizable'); return false;\"><BR><img border=0 src=\"thumbs/$thumb[$i]\"><br /> </a></td>";


You can replace $images[$i] with your actual page or image name. And the same is true for img src.

Important Note: Figuring out the correct placement of the quotes was the hard part!
Watch for the placement of quotes (")!

Hope this helps!

Back to PHP FAQ Index
Back to PHP Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close