Page 1 of 1

select to popup

Posted: Sun Dec 21, 2003 3:32 pm
by shaunmckinnon
Here's what i want to do.

Someone comes onto my site, chooses from a jump menu a category, the it jumps them to that categories page (in a nice little popup window). Now I know people hate popups, yayayaya...but this is for a local page on my computer, and i need these silly windows to work.

I thought of using php, and I know it would do what i need it to do. if someone can suggest the coding for this, i'm sure it's completely simple.

thanks in advance,
Shaun McKinnon

Posted: Sun Dec 21, 2003 4:01 pm
by DuFF
You will need to use javascript to create a popup window, PHP is serverside and therefore cannot alter any thing after it has passed from the server to the client. You can pass PHP variables into javascript though, something like this:

Code: Select all

<a href="javascript:window.open('$categorypage')">Open Page</a>
Javascript Popup Windows:
http://tech.irt.org/articles/js128/

one possible solution

Posted: Sun Dec 21, 2003 4:05 pm
by Hurklefish
Well, as far as popups go, I don't know of any way to do it without clientside script of some sort, i.e. javascript or vbscript.

Using the window.open command, you can pass various parameters to the window so that it won't have the address bars, nav. buttons and such.. (search for "chromeless window" )

If your jump menu is in a <select> drop down box, I believe you could have a window.open script launch in the selected event of the dropdown box. I don't remember all the details..

Now, if you're like me, and you want an all php/html solution with no client side script, you might consider making your jump menu a series of hyperlinks set to open the destination in a new window, and not worry about the fact that it has all the nav buttons and such.. something like..

Code: Select all

<A href='myNewPage.htm' target = '_BLANK'>Click to open in a new window</A>
Other than the user clicking a link with the target set to blank, or a script window.open command, I don't know of any other way to open a new window.

Last, you might want to look at the javascript version of message boxes, or alert boxes, or whatever they call them. Might do the trick too.