Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
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
 
Old August 14th, 2003, 12:18 PM
Authorized User
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Full-sized window once clicked on picture

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).

Searched for hours but no solution found :( Can anyone help?

 
Old August 14th, 2003, 05:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

try something like this:

w = screen.availWidth;
h = screen.availHeight;

var popwindow = parent.window.open('newpage.html', '', 'location=no,width='+w+',height='+h+',menu=no,bord er=0,status=no')

you may also pass the parameter to the page that describes which picture should be viewed in a new window (see a similiar topic on passing arguments to other windows - http://p2p.wrox.com/topic.asp?TOPIC_ID=2325 )

:D:D:D:D:D:D

the genuine genius
 
Old August 15th, 2003, 02:53 AM
Authorized User
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, seem to be on the right track ;)

Instead of the new window opening automatically, i want it to open when one clicks on the small preview picture (OnClick), and the window to start at top left corner (target="_top" ?)

Here the Body:

<body ><p><a href="Burton_morges03.jpg" target="_self"><img border="0" src="Burton_morges03.jpg" width="163" height="123"></a> </p>
<script language="JavaScript">
w = screen.availWidth;
h = screen.availHeight;

var popwindow = parent.window.open('newpage.html', '', 'location=no,width='+w+',height='+h+',menu=no,bord er=0,status=no')
</script>
</body>

I didnt insert or change any values for width or height, hope i did it right :)

 
Old August 15th, 2003, 04:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

to do so you gotta have a function and then just invoke it when user clicks the picture:

<script>

function mypopup()
 {
  mywindow = window.open("picture.jpg","mywindow","location=0,s tatus=0,scrollbars=1,width=100,height=100");
  mywindow.moveTo(0,0);
 }

//moveTo(x,y) method moves the window to x,y position on the screen

</script>

<body>
 <p>
  <a href="javascript:mypopup()">
   <img src="Burton_small.jpg">
  </a>
 </p>
</body>


depending on how you want the new window to look like, modify its features in window.open() method (width, height etc...)

:D:D:D:D

the genuine genius
 
Old August 15th, 2003, 09:08 AM
Authorized User
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi again Genius!

Thanks for your effort and time, but the function codes seems too long, as I have several pictures I want to open the same size.

What about this one? (shorter):

<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, once in new window. Also, I need a 'close window' link to go back to previous page.

If you could help me again i would appreciate it :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixed Sized Transparent Border nerssi CSS Cascading Style Sheets 0 September 26th, 2008 03:23 AM
Change existing browser window to full screen ednaswap Javascript 0 August 17th, 2006 08:41 PM
How to replace a picture with another when clicked BLaZuRE Beginning VB 6 2 March 11th, 2006 04:08 PM
How to tell which button clicked emily PHP How-To 2 November 30th, 2004 01:35 PM
OLE picture - accessing the picture property bdcrisp Excel VBA 0 December 7th, 2003 09:35 PM





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