Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Web Development Languages (http://www.programmingforums.org/forum40.html)
-   -   Create A Pop-up Window (http://www.programmingforums.org/showthread.php?t=617)

Xko Sep 21st, 2004 11:30 AM

not sure which language you'd use for this so i posted here...

basically what i want to create is a small pop-up window so that when a user clicks on a link to a game screenshot they get a small pop-up of it instead of being taken to another page.

I think it might be java-ish but again i'm not too sure.

Ooble Sep 21st, 2004 11:52 AM

Not Java, JavaScript. They're totally different - the only thing in common is the name. In the <a> tag, simply put:
:

onClick="javascript:window.open('<url>'); return false;"
As you can probably see, this opens the window you place in the brackets. The "return false" bit tells the link not to go wherever it was going - you still put the href bit in for people who don't use JavaScript.

An alternative (and probably a better idea) is to put this into a bog-standard link:
:

target="_blank"

With the JavaScript, you can change the width and the height of the window, but someone else is gonna have to help you with that.

Xko Sep 21st, 2004 12:09 PM

Right ok, so if i had this link...

1

should then now read...

<a onClick="javascript:window.open('<http://www.classic-games.org/screenshots/alienbreed01.gif>'); return false;"</a>

?

Ooble Sep 21st, 2004 12:11 PM

Not quite. It should be either:
:

<a href="http://www.classic-games.org/screenshots/alienbreed01.gif" onClick="javascript:window.open('http://www.classic-games.org/screenshots/alienbreed01.gif'); return false;>1</a>

Or:
:

<a href="http://www.classic-games.org/screenshots/alienbreed01.gif" target="_blank">1</a>

Xko Sep 21st, 2004 12:18 PM

Ok i've used the latter of your two quotes (as it's shorter!) but yet when i upload it, then click the link it takes me to a new page, not create a popup on the same page.

hmmm?

big_k105 Sep 21st, 2004 1:12 PM

did you try the first one. the one that is longer? if not give that a try as that should work :)

Xko Sep 21st, 2004 1:25 PM

i did, but i think there must be one or more characters/symbols missing as it's not just the '1' that is the link, it's everything afterwards and i'm not too sure what i need to insert or where.

must be a confidence thing!?!

sarumont Sep 21st, 2004 9:43 PM

Ooble jipped you on quotes. ;) You need to add a double-quote (") to the left of the > before the 1.

:

;">1</a>

Xko Sep 22nd, 2004 8:05 AM

That's the one...i knew something was missing, what & where though i wasn't too sure.

Thanks sarumont!

Another question though if you gents would be so kind...

Here's the page i want the popup window to 'popup' on...here now when i click the '1' for the first screen shot it still goes to a seperate page.

My question is, is the popup actually working but it's just that the size of the popup window is 'full size' and that i need to resize the window?

Sorry for all the questions! - but you're a great help! :D

Xko Sep 22nd, 2004 8:38 AM

Sorted!

I have just found this site here that actually takes the information you input and creates the code afterwards and bam! it works!

Here was the final coding anyway...:D

Open the Popup Window

All i need to do now is change a bit of the wording around.

Thanks all!


All times are GMT -5. The time now is 10:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC