Welcome to WebmasterWorld Guest from 54.145.174.178

Forum Moderators: open

Message Too Old, No Replies

Popup window - how to center content into popup window

popup

   
5:14 pm on Sep 25, 2009 (gmt 0)

5+ Year Member



Hello,

Please, can someone tell me how I can (if I can), when open popup window after user click in link - new window to be with some specified dimension, but content of page which is in window to start from some line which I will define?
Do that is possible?

Thank you very much, Mladen

7:10 pm on Sep 26, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome aboard mladja04, if your pop up is an external resource or static web page, you can center content by including CSS or a link to external CSS in the head.

<style type="text/css">
#main { width: 95%;, margin: auto; }
</style>

or

<link rel="stylesheet" type="text/css" href="mystyle.css">

If it's written out with document.write, you can do the same:

document.write('<link rel="stylesheet" type="text/css" href="mystyle.css">');

If you mean center the pop up in the viewport, you will probably have to get the viewport's parameters (width, height, etc.) first with Javascript, then do some math to position it in the center of the viewport. No code immediately handy, but a search for Javascript Window Object should turn up some results. Note that Moz browsers and IE have different ways of getting these.

8:21 pm on Sep 26, 2009 (gmt 0)

5+ Year Member



Thank you for reply. I need to open external page in popup window and want to know do I can to specify start row in that new page.
This is code which I use (example):

<!-- TWO STEPS TO INSTALL POPUP WINDOW:

1. Paste the first into the HEAD of your HTML document
2. Use the code to open the popup page on your site -->

<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by: Nic Wolfe -->
<!-- This script and many more are available free online at -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=600');");
}
// End -->
</script>

<!-- STEP TWO: Use the following link to open the new window -->

<A HREF="javascript:popUp('http://www.mysite.com')">Open the Popup Window</A>

<!-- Script Size: 0.73 KB -->

Do it possible to I make what I need?

Thank you very much again.
Mladen

 

Featured Threads

Hot Threads This Week

Hot Threads This Month