Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 38
Viewed: 3189
Added: Apr 23, 2012
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

loads a picture in a popup with no borders in the popup.

<!---Head--->
<script type="text/javascript">
function LoadPhoto(the_href) {
var centerWidth = (window.screen.width - 630) / 2;
var centerHeight = (window.screen.height - 420) / 2;
var w = window.open('', 'Photo', 'width=630,height=420,left=' + centerWidth + ',top=' + centerHeight );
w.document.writeln("<HTML><HEAD>");
w.document.writeln("<TITLE>" + the_href + "</TITLE>");
w.document.writeln("<STYLE> BODY { margin-left: 0; margin-top: 0 } </STYLE>");
w.document.writeln("</HEAD><BODY><a href='javascript:self.close();'><img");
w.document.writeln("src='" + the_href + "'");
w.document.writeln("onMouseOver='window.status='click image To Close this window'; Return True;'");
w.document.writeln("onMouseOut='window.status='';'");
w.document.writeln("border-0 width=630 height=420");
w.document.writeln("alt='click image to close this window'");
w.document.writeln("title='click image to close this window'");
w.document.writeln("></a>");
w.document.writeln("</BODY></HTML>");
w.document.close();
w.focus();
}
</script>

<!---Body--->


 // call it like this

<a href="javascript:LoadPhoto('images/image1.jpg')">View image</a>


Subject: Does not work
[ Reply ]
Comment By: Cap on 23rd of January 2011 06:52 PM

Does not work. Under Windows Internet Explorer 8, the script section is flagged with a message indicating a parenthesis is missing on the following line of code:

w.document.writeln("onMouseOver="window.status='click image To Close this window'; Return True;"");

Subject: Re: Does not work
[ Reply ]
Comment By: Snippet on 05th of February 2011 08:36 AM

I found the problem and it should now work fine.

Subject: About centering the window
[ Reply ]
Comment By: Chris on 27th of February 2012 02:19 PM

Hi there,

This a very a very good script for a borderless window. i have tried however to add some code in order to center it on the screen but I've had no luck until now. Could you post some code for centering it in the browser window?

Subject: Re: About centering the window
[ Reply ]
Comment By: Snippet on 23rd of April 2012 05:58 AM

I have added some code to center the window. Just change the numbers to match the size of your image


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions