|
| 1 - 12 of 12 [Total 1 Pages] |
|
|
Center/change Current Window Jul 27, 2002, 13:32 |
1 |
|
I've found a bunch of stuff online about opening a new window that is centered... but I want to center a current window (that is a popup, but I want to center it from within the page). I know how to resize from within the page. How do I center it? Oh, and I'd also like to know how to take away the scrollbars, toolbars, statusbar, etc of the current window. BTW, this is the code I use (and it works) to resize the window. I want to add on to it to do the other stuff as well: Code: <script language="JavaScript">window.resizeTo(500,100)</script>
|
|
|
Jul 28, 2002, 15:53 |
2 |
|
Okay, I decided on how I want to do it (I think)... but I get a problem now: Here's my page: http://www.ax2.org/phil/popup.aspThere must be something wrong with the code, but I don't know what. When you click the link it opens the window, but the main window says "[object]" Here's the link code... Code: <a href="javascript:window.open('/shared/popup/extremeexcursion.asp', 'ax2popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=150,left = 262,top = 284')">Extreme Excursion Info</a>
|
|
|
Jul 28, 2002, 16:07 |
3 |
|
It works... I did this: Code: <a href="/shared/popup/extremeexcursion.asp" onclick="window.open('/shared/popup/extremeexcursion.asp', 'ax2popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=150,left = 262,top = 284'); return false;">Extreme Excursion Info</a>
|
|
|
Jul 28, 2002, 19:07 |
4 |
|
That's great! Sometimes the href="javsacript:function()" is less than reliable. But remember, setting a feature equal to 0 is the same as not including it at all! So your lines could be much shorter! Code: window.open('/shared/popup/extremeexcursion.asp', 'ax2popup', 'width=500,height=150,left = 262,top = 284');-- instead of -- Code: window.open('/shared/popup/extremeexcursion.asp', 'ax2popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=150,left = 262,top = 284');
|
|
|
Jul 28, 2002, 20:15 |
6 |
|
Quote: [b]That's great! Sometimes the href="javsacript:function()" is less than reliable. |
thats only really with older browsers, but i would have thought that a popup in this context would be just fine as it is.
|
|
|
Jul 27, 2002, 14:13 |
7 |
|
Okay, I played around and I got this: Code: <script language="JavaScript">var w = 500var h = 200window.resizeTo(w,h)var winl = (screen.width - w) / 2;var wint = (screen.height - h) / 2;window.moveTo(winl,wint)</script> I think that works correctly. If it doesn't, please let me know what is right. Now, I just want to know how (if possible) to get rid of the Status bar, Scroll bars, and Tool bars from the current window. Please help!
|
|
|
Jul 27, 2002, 19:04 |
8 |
|
I've never seen any code that lets you dynamically remove window elements. To the best of my knowledge, that can only be controlled at window creation.
You could open a new window will all the elements removed and have it load the document you want, and then close it's opener. Just a thought.
|
|
|
Jul 27, 2002, 21:38 |
9 |
|
Quote: I've never seen any code that lets you dynamically remove window elements. To the best of my knowledge, that can only be controlled at window creation.
You could open a new window will all the elements removed and have it load the document you want, and then close it's opener. Just a thought. |
That might work... how would I close the "opener" window? See what I'm doing is starting off with a Main Page. What I want is just to have links that say like popup.asp?page=friday.htm This is working fine (currently it opens a new window and the window resizes itself)... but I want that popop to have no toolbars, etc. The reason I was doing it this way instead of having a function to open a new window on the main page was b/c I didn't want all that extra code on every page. If there is a way to use a .js that I can use, I guess I would rather do that than have 3 windows going instead of 2... but I just wanted this to be pretty easy by having a one time thing using ASP where I didn't have to mess with a javascript function. Any ideas?
|
|
|
Jul 28, 2002, 07:56 |
10 |
|
Well, you just reference the window's opener by 'window.opener' so to close it would be 'window.opener.close()'
I don't know ASP, so I'm not sure I can help ya there. Does each page open a different URL for the popup? What is the association?
|
|
|
Jul 28, 2002, 09:24 |
11 |
|
Quote: Well, you just reference the window's opener by 'window.opener' so to close it would be 'window.opener.close()'
I don't know ASP, so I'm not sure I can help ya there. Does each page open a different URL for the popup? What is the association? |
So what code exactly would have to be on the opener window for it to open a new window, then close itself?
|
|
|
Jul 28, 2002, 09:47 |
12 |
|
Code: var w = 500var h = 200var winl = (screen.width - w) / 2;var wint = (screen.height - h) / 2;var features = "width="+w+", height="+h+", top="+wint+", left="+winl;window.open(top.location.href,'',features);top.close();
|
|
| 1 - 12 of 12 [Total 1 Pages] |
|
|
|