Go Back   Dynamic Drive Forums > General Coding > HTML
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-31-2006, 05:17 PM
Cheng Cheng is offline
Regular Coders
 
Join Date: Jan 2006
Posts: 221
Thanks: 3
Thanked 0 Times in 0 Posts
Question Center Popup Window without Javascript?

Hi.

I got this program FormArtist which provides a link to open the form in a popup window.
Bu the window is not a 100% centered on the screen.
Is it possible to center this popup window without javascript?
Here wghat the link looks like:
Quote:
<a href="#" onclick="window.open('http://www.arbitrade.org/Form/arbitrade.htm', 'arbitrade', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=690,height=530');">Contact Form</a>
I think it is possible as someone showed me before how to open a window centered without javascript but I don't have that piese of code anymore.
Maybe someone here can show me what to change in this code here to center the popup.

Thanks inadvance.

Cheng
Reply With Quote
  #2  
Old 08-31-2006, 05:53 PM
mwinter mwinter is offline
Elite Coders
 
Join Date: Dec 2004
Location: UK
Posts: 2,361
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Cheng
I got this program FormArtist which provides a link to open the form in a popup window.
You shouldn't use a pop-up window, especially for a contact form (as this would appear to be). Pop-ups are unreliable, have been for a while, and are becoming less and less viable. How do you expect someone to contact you if the pop-up is blocked, or, with the code you posted, with scripting disabled?

Quote:
Bu the window is not a 100% centered on the screen.
Putting it there reliably isn't very feasible; most solutions you'll find on the Web don't consider multiple monitors.

Quote:
Is it possible to center this popup window without javascript?
No, not at all.

Quote:
<a href="#" onclick="window.open('http://www.arbitrade.org/Form/arbitrade.htm', 'arbitrade', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=690,height=530');">Contact Form</a>
At least rewrite that to:

Code:
<a href="http://www.arbitrade.org/Form/arbitrade.htm" target="arbitrade"
    onclick="return !window.open(this.href, this.target, 'scrollbars,resizable,width=690,height=530');"
  >Contact Form</a>
A pop-up should always have scrollbars enabled and be resizable. If you gave it the right size, neither will matter. However, if you didn't, the content will be clipped and inaccessible.

Quote:
Maybe someone here can show me what to change in this code here to center the popup.
If you must use pop-ups, let the window manager handle positioning.

Mike
Reply With Quote
  #3  
Old 08-31-2006, 07:37 PM
Cheng Cheng is offline
Regular Coders
 
Join Date: Jan 2006
Posts: 221
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi Mike.

Thanks for the advise.
What do you meam by:
Quote:
If you must use pop-ups, let the window manager handle positioning.
Thanks again.

Cheng
Reply With Quote
  #4  
Old 08-31-2006, 10:00 PM
mwinter mwinter is offline
Elite Coders
 
Join Date: Dec 2004
Location: UK
Posts: 2,361
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Cheng
What do you meam by:
Quote:
If you must use pop-ups, let the window manager handle positioning.
The window manager controls window positioning, amongst other things. It will know the preferred monitor in multi-monitor systems, where the last window created was positioned, how to cascade windows, and so on. Leave it to make the decision.

Mike
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:57 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.