Image open in seperate window.

  • Thread starter Thread starter chaps
  • Start date Start date
C

chaps

How can I open an image in its own window when clicked on and can it open at
the actual size of the image or is there a default size to open the image
at. I am using FP2003

Any help would be good.


thanks
paul....
 
Hi Paul
The easiest way is to right click the image select hyperlink then target
frame and select new window
There is another way using an addin called Spawn where you can choose the
size of the window and loads more stuff
Paul M
near the bottom of the page
http://www.jimcoaddins.com/addins.aspx
 
Download the free FP addin SPAWN from www.jimcoaddins.com

BTW, you cross posted to some newsgroups that no longer exist.
--
===
Tom "Pepper" Willett
Microsoft MVP - FrontPage
---
About FrontPage 2003:
http://office.microsoft.com/home/office.aspx?assetid=FX01085802
How to ask a newsgroup question:
http://support.microsoft.com/kb/555375
===
| How can I open an image in its own window when clicked on and can it open
at
| the actual size of the image or is there a default size to open the image
| at. I am using FP2003
|
| Any help would be good.
|
|
| thanks
| paul....
|
|
 
In <HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function fullScreen(theURL) {
window.open(theURL, '','toolbar=no,resizable=yes,scrollbars=yes');
}
// End -->
</SCRIPT>

For each picture:
<a href="javascript:void(0);" ONCLICK="fullScreen('pic1.jpg');">
<img border="4" src="pic1_small.jpg" xthumbnail-orig-image="pic1.jpg"
width="200" height="150"></a>

Use AutoThumbnails to create the _small file. FP do not add the width &
height, so you must do that manualy. Without width & height it don't work.

Hope this helps.
Norski
 
Russell said:
How would you add a "close window" button to this?

You can't add a close button to a .jpg file.

You need to call an .html file which displays the .jpg and also has the
close button in it

Something like
<html><head></head>
<body>
<img src="pic1.jpg" alt="Picture 1"><br>
<input type="button" value="Close" onClick="window.close()">
</body>
<html>

If you name this pic1.html, then change
ONCLICK="fullScreen('pic1.jpg');"
to
ONCLICK="fullScreen('pic1.html');"
 
Thanks, I obviously meant add the close button to the window, not the image.

Is there anyway to have a close button in that pop up that will just close
the window and not have ask for confirmation first?

Thanks,
Russell
 
Russell said:
Thanks, I obviously meant add the close button to the window, not the
image.

Is there anyway to have a close button in that pop up that will just
close the window and not have ask for confirmation first?

Yes, the method I gave adds a close button to the pop-up window. (I haven't
actually tested this exact code, but I have used similar.)

Clicking on the close button will cause a prompt if the window is not opened
by yourself (not sure of the exact details).
To avoid this, give the window.opener property a dummy value - can be
anything. Then it is happy and doesn't prompt.

Try this:
<input type="button" value="Close"
onClick="window.opener='fred';window.close()">
 
Hello Trevor,

This method for closing the window works great in IE but has no effect in
Mozilla or Netscape. Any other ways that you know of?

Thank you,

Russell
 
Here are a couple you can try:

<a href="javascript:window.close();">Close Window</a>

--or--

Form Button:

<form>
<div align="center"><center><p><input TYPE="button" NAME="close"
VALUE="Close this Window" onClick="self.close()"></p>
</center></div>
</form>
--
===
Tom "Pepper" Willett
Microsoft MVP - FrontPage
---
FrontPage Support:
http://www.frontpagemvps.com/
About FrontPage 2003:
http://office.microsoft.com/home/office.aspx?assetid=FX01085802
===
| Hello Trevor,
|
| This method for closing the window works great in IE but has no effect in
| Mozilla or Netscape. Any other ways that you know of?
|
| Thank you,
|
| Russell
|
|
| | > Russell wrote:
| > > Thanks, I obviously meant add the close button to the window, not the
| > > image.
| > >
| > > Is there anyway to have a close button in that pop up that will just
| > > close the window and not have ask for confirmation first?
| >
| > Yes, the method I gave adds a close button to the pop-up window. (I
| haven't
| > actually tested this exact code, but I have used similar.)
| >
| > Clicking on the close button will cause a prompt if the window is not
| opened
| > by yourself (not sure of the exact details).
| > To avoid this, give the window.opener property a dummy value - can be
| > anything. Then it is happy and doesn't prompt.
| >
| > Try this:
| > <input type="button" value="Close"
| > onClick="window.opener='fred';window.close()">
| >
| > --
| > Cheers,
| > Trevor L.
| > Website: http://tandcl.homemail.com.au
| >
| > >
| > > Thanks,
| > > Russell
| > >
| > > | > >> Russell wrote:
| > >>> How would you add a "close window" button to this?
| > >>
| > >> You can't add a close button to a .jpg file.
| > >>
| > >> You need to call an .html file which displays the .jpg and also has
| > >> the close button in it
| > >>
| > >> Something like
| > >> <html><head></head>
| > >> <body>
| > >> <img src="pic1.jpg" alt="Picture 1"><br>
| > >> <input type="button" value="Close" onClick="window.close()">
| > >> </body>
| > >> <html>
| > >>
| > >> If you name this pic1.html, then change
| > >> ONCLICK="fullScreen('pic1.jpg');"
| > >> to
| > >> ONCLICK="fullScreen('pic1.html');"
| > >> --
| > >> Cheers,
| > >> Trevor L.
| > >> Website: http://tandcl.homemail.com.au
| >
| >
|
|
 
Thanks Tom,

I only tried these in IE, but both request confirmation to close the window.
Is there any way to put a close window button in that will not require
confirmation and work in IE and other browsers?

Thanks

Russell
 
Yes, if you create a popup via JavaScript,

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
HI Thomas,

I am using Jimco's Java Script Spawn add-in. I have tried various close
buttons in the spawned windows. All result in an alert box requiring
confirmation before closing the window, except the one from Trevor in this
thread. His works in IE but his doesn't work in Netscape or Firefox. Any
suggestions?

Thanks

Russell
 
Can you provide a link to the page that has a link to the popup create and with the close window
script?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
Russell,
I had a look at this thread today with comments from some experts.

On your site, I found some links with close buttons on them which worked in
IE6, but in Firefox the close button didn't work at all, let alone give a
prompt - it did nothing!! Is that what you found.

I am no expert, but I read here that setting window.opener to 'fred' or
'george' or 'asjhelrir' works only because of a bug in most browsers. But
strangely, this code doesn't work at all in Firefox: <input type="button"
value="Close" onClick="window.opener='fred';window.close()"> ??

Tom suggested these
<a href="javascript:window.close();">Close Window</a>
--or--
<form>
<div align="center"><center><p><input TYPE="button" NAME="close"
VALUE="Close this Window" onClick="self.close()"></p>
</center></div>
</form>

The form button method is the same as what you have, except that the syntax
is correct. (An input button should not be used outside a <form>, and Tom
has corrected this.)

So it is a mystery to me.

One thought I had is:
Why add a "Close" button at all?
Wouldn't it be clear to most that clicking the red "X" in the top right hand
corner will close the pop-up window?
 
This script will work in all browsers, using new windows or pop-up windows.
However, most browsers (Firefox seems to be the exception) will ask for
confirmation if the window has any history, that is if the back and/or
forward buttons are active (or would be active if they were displayed). I
have yet to find a browser that does ask for confirmation if there is no
history - unless you are closing the only open browser window. Any script
involving window.opener seems to fail in Firefox - but this is required
to eliminate the confirmation dialogue in other browsers.
 
Here is the close window script that I use, and it works in IE6, Firefox, Opera, NS6.21, NS7.0:

<a href="javascript:void(0);" onclick="window.close();">Close This Window</a>

I only use this on windows that I have created via JavaScript, not the _blank target value, to avoid
the Warning dialog.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
The last code worked. My thanks to Thomas and Trevor for helping out. Once
again I am indebted to the MVPs.

Russell
 
Back
Top