Photo's won't open in new browser window

M

Mbraid96

I've got my site up using Pub03 and I have my photo gallery all set up on the
page but when I click on the thumbnail the picture opens in the same (main)
IE browser window. I'd like to make the pictures open in a new window so
viewers don't have to click the back button to navigate to another picture.
I've tried searching google for help with this and the only help I've been
able to find was the following link:
http://office.microsoft.com/en-us/assistance/HA011587451033.aspx

I tried to use the ECMA Script code snipet from the link listed above to get
my hyperlinks to open in the new window, but after updating my page all I get
is the 'Error on Page' exclamation mark in Internet Explorer and nothing
opens. I can revert my site to the old style and the picture will open fine
in the same window. This leads me to belive its a possible problem with the
following code I've inserted in the HTML fragment box?
<script language="JavaScript" type="text/javascript"> <!-- function
Show(Url, Name, Features) { window.open(Url, Name, Features); } // -->
</script>


When hyperlinking my picture I use the following path and the coresponding
image files are on my hosting server:

javascript:Show('http://www.dominionpools.com/index_files/Recent_Commercial/KB.jpg',
'newwindow', 'toolbar=no,scrollbars=yes,resizable=yes,height=250,width=250')


Thanks in advance to anyone that can help!
 
D

DavidF

Someone else had this problem before, and another poster suggested a
solution:

"The problem with the script on page HP030805631033.aspx is that it includes
'comment out' code, meant to prevent older browsers from displaying the
script as HTML. The script does work if you remove the 'comment out' code.


The script on page HP030805631033.aspx is: <script language="JavaScript"
type="text/javascript"> <!-- function Show(Url, Name, Features) {
window.open(Url, Name, Features); } // --> </script>.


To make it work use: <script language="JavaScript" type="text/javascript">
function Show(Url, Name, Features) { window.open(Url, Name, Features); }
</script>


This is the same script, but without the 'comment out' code of <!-- and //
-->.


I do not know why the 'comment out' code causes this problem... but the code
does work without the 'comment out' code, and if anyone is using such an old
browser that it does not understand javascript, then it is way past time for
them to upgrade browsers anyway...


Cheers,


Glenn "

Please let me know if it works for you.

DavidF
 
D

DavidF

I would like to know if the "fix" I posted from the other user works, so let
me know. However, if you can't get it to work, here is an alternative.

Here is the code snippet I use, that you can possibly adapt to your site:

--------

<A target="_blank"
HREF="http://www.yoursite.com/images/yourfullsizeimage.jpg"><IMG
SRC=http://www.yoursite/images/yourthumbnailsizeimage.jpg" ALT="what ever
you want text" border="0" width="120" height="60"></A>


---------------

You would have to create a subfolder on your site called "images" and move
your images there, or rewrite the links to where you want to keep the
images. Then upload both yourfullsizeimage.jpg and
yourthumbnailsizeimage.jpg to that folder. Change the names of the jpg files
to the name of your jpg and the file path. The Alt tag is optional, and you
can change the border, width and height etc. Copy and paste the code snippet
into the code fragment box using Ctrl + V to paste, and put the code
fragment box where you originally had the thumbnail on your Pub page. Delete
the original thumbnail, as it will now be imported.

I also use this approach to run the whole slide show. I create a separate
Publisher document, with custom sized pages just large enough for me to
insert the full size images and enough pages for all the images, then add
arrows or text with hyperlinks to the next picture, or last picture etc. I
upload the HTML to another folder on my site and create links to the images
as above, from my main page.

Its probably easier to understand this if you understand how to build a site
with multiple Publisher documents. For example I would not put your
Recent_Commercial folder within your index_files folder. I would create the
folder at the same level...but perhaps this is just confusing. Read David
Bartosik's article, and perhaps you will understand what I am trying to say:
http://msmvps.com/blogs/dbartosik/archive/2006/01/16/81264.aspx

DavidF
 
D

DavidF

Oh, and one other thing. I make the size of the new window, the same size as
the new Pub HTML that has the full size images...

DavidF
 
M

Mbraid96

Awesome! Thanks for the help! The code you posted worked great! I can't tell
you how many times I banged my head against the wall on this one. lol. We
should tell MS to update their Answer Box site with the PROPER code. I'm in
the process of resizing the new browser windows to my images. Thanks again
DavidF.

V/R
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top