Window Position - Page 1

User 371836 Photo


Registered User
20 posts

Hi all.

I'm back with another question.

I have maid a link to a html site that shows some photos.
This photo site have a fixed window size.
It's works perfect, BUT

Does anybody know how i can get this window to be in center position of the screen. No matter with Inch your monitor is???

I have setup up a test page (Again) to demo the "problem" if any want's to take a look on how i may do it.

The adress www.stegmann.cc

Thanks alot.

Bjarne
User 355448 Photo


Ambassador
3,144 posts

Bjarne,

Are you wanting horizontal centering? You have in your code some lines that look like this:

<h1>HD OB - BestBroadcastHire</h1>
<div id="framedivleft">
<iframe onload="autoResize('thumbframe');" src="pages/thumbnail/thumbnailpage1.html" align="right" width="100%" frameborder="0" id="thumbframe" name="leftframe" scrolling="auto"> </iframe>
</div>
<div id="framedivright">
<iframe onload="autoResize('imageframe');" src="pages/image/imagepage1.html" align="right" width="100%" frameborder="0" id="imageframe" name="fullframe" scrolling="auto"> </iframe>
</div>

If you add a div around these two divs, you can style the surround div to have automatic left and right margins. Another option would be to center the entire page with automatic left and right margins.
User 371836 Photo


Registered User
20 posts

billr wrote:
Bjarne,

Are you wanting horizontal centering? You have in your code some lines that look like this:

<h1>HD OB - BestBroadcastHire</h1>
<div id="framedivleft">
<iframe onload="autoResize('thumbframe');" src="pages/thumbnail/thumbnailpage1.html" align="right" width="100%" frameborder="0" id="thumbframe" name="leftframe" scrolling="auto"> </iframe>
</div>
<div id="framedivright">
<iframe onload="autoResize('imageframe');" src="pages/image/imagepage1.html" align="right" width="100%" frameborder="0" id="imageframe" name="fullframe" scrolling="auto"> </iframe>
</div>

If you add a div around these two divs, you can style the surround div to have automatic left and right margins. Another option would be to center the entire page with automatic left and right margins.

Hi Billr

I want to center the hole page to the screen.
My window have been set to a fixed size 800x790px
I want that "popup" window to be at the center horizontal and vertical on the screen.

How to do that?

Is it though a java script?
Some html code?

Regards Bjarne
User 355448 Photo


Ambassador
3,144 posts

Bjarne,

I suspect your javascript could be modified, but I do not have the javascript skills to do that. Your current code looks like this:

<img src="mouse_over.gif" alt="bbh ob" onclick="MM_openBrWindow('picture/bbh_ob/index.html','','status=yes,width=805,height=750')" />

That is the code that creates the window, specifies the window size, and loads the source. Some changes might set the location, but this is NOT a window on your current page, but is a separate browser window.

If you want it to be centered in your current page, you may want to use an iframe.
User 371836 Photo


Registered User
20 posts

Hi Billr.

Yes i think your are right.
Some code in the line where i open and set the size of my browser window, could do the trick. But I don't know how to do it eighter.
It's not the content in the page i want to center. But the entire Browser window.

Can some one help here?
Please

Regards
Bjarne
User 282670 Photo


Registered User
3,940 posts

Here's a code you can use, or maybe see how it's coded. The first part goes in the head section..
<Script Language=JavaScript Type='Text/JavaScript'>


function Pop(url_pop,name,etc) {

var lef = (window.screen.width-805)/2;
var to = (window.screen.height-750)/2;

window.open(url_pop,'Up','width=805,height=750,left='+lef+',top='+to);

}

</Script>

*****this next part in the body section...
<A href="#" onMouseOver="Pop('picture/bbh_ob/index.html')" title="Pop Window"><img src="mouse_over.gif" alt="bbh ob" ></a>

I took the liberty to add your mouseover image to the code,





Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.