Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
| Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 2nd, 2003, 04:27 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pop-up window, on top of webpage

I have a small "thumb" picture on a htm-page and when one clicks on the image i want a new window opening of that picture in full size (maximized).

Here I have an example of what it COULD (mustn't be same) look like:

<body>
 <p>
<a href="PICTURE.jpg" OnClick="window.open('PICTURE.jpg', 'big', 'fullscreen=yes')"><img border="0" src="PICTURE.jpg" width="172" height="129">
 </p>
 </a>
</body>

The only problem i have here is that the image opens twice; once redirected (not needed), and once in new window (correct). Also, I need a 'close window' link to go back to previous page.

  #2 (permalink)  
Old September 2nd, 2003, 04:36 AM
Friend of Wrox
Points: 1,315, Level: 14
Points: 1,315, Level: 14 Points: 1,315, Level: 14 Points: 1,315, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hi :)

You need to add "return false" at the end of the onclick. This will kill the link event and stop the link from opening in the primary window too.

<a href="" onclick="window.open(); return false">

To create a close button you could use window.close().

(o<
//\ =^..^=
  #3 (permalink)  
Old September 2nd, 2003, 10:49 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Before you send your reply, test the "Post New Reply" on this site - that's what I would like to have!"

Hi :D

The return false was the solution, thx a lot!

Now for the window.close, what do I need? Something like this':
"javascript:window.close()">Close Window<

Here's the body:

<body>
<p>
<a href="PICTURE.jpg" OnClick="window.open('PICTURE.jpg', 'big', 'fullscreen=yes'); return false"><img border="0" src="PICTURE.jpg" width="172" height="129">
</a>
</body>

  #4 (permalink)  
Old September 2nd, 2003, 10:52 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

*ooops* I meant PREVIEW your reply

  #5 (permalink)  
Old September 3rd, 2003, 03:55 AM
Friend of Wrox
Points: 1,315, Level: 14
Points: 1,315, Level: 14 Points: 1,315, Level: 14 Points: 1,315, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Why should I preview? Did I write something funny that I don't see myself?

You use it in an event handler in the same way as the window.open(). If you want it to work in Ye Old Browsers like Nav 4 it needs to be in a link. If that doesn't matter you don't have to use a link.

For example:
<a href="#" onclick="window.close()"><img src="closepic.gif"></a>

(o<
//\ =^..^=
  #6 (permalink)  
Old September 3rd, 2003, 04:29 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi Meow...

No not at all, your posts are great! The PREVIEW is just an example of how I would like the CLOSE WINDOW link to be.

Can you please copy+paste the body i posted previously and insert the close.window() in the right place for me.... i know i am terrible, a real novice

I tried it myself, but the 'close window' appears on the main page, and not in the pop-up window. Do I not have to include it within the brackets of OnClick below to be in that window?:
OnClick="window.open('PICTURE.jpg', 'big', 'fullscreen=yes'); return false">

Sorry for the inconvenience and would appreciate your answer mate...



Similar Threads
Thread Thread Starter Forum Replies Last Post
opening a webpage in a new window riyadsmail ASP.NET 1.0 and 1.1 Basics 3 August 31st, 2007 06:56 AM
Window refresh and window pop up in Java Script Aleksandra Javascript How-To 2 March 2nd, 2007 06:47 PM
How to pop up a window ON TOP OF the Start Bar. BananaJim Javascript How-To 1 February 27th, 2007 06:28 AM
Keep Div at Top of Window TSEROOGY CSS Cascading Style Sheets 11 November 7th, 2004 10:14 AM
pop up window sankar VB How-To 0 July 29th, 2003 01:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.