...

View Full Version : New Window Properties



hothousegraphix
06-01-2003, 04:22 AM
I'm using the following script in a redirect page. For some reason I'm unable to define only one window attribute - this example shows "scrollbars".

What do I need to do to add say..."toolbar"?



<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
//800 x 600//
if ((screen.width == 800) && (screen.height == 600)){
var targeturl="http://www.cartoonnetwork.com/"//url used for testing//
newwin=window.open("","","scrollbars")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}
//or else 1280 x 1024//
else if ((screen.width == 1280) && (screen.height == 1024))
var targeturl="http://www.hothousegraphix.com/tests/Hhg2Layout.html"
newwin=window.open("","","scrollbars")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}
// End -->
</script>

chrismiceli
06-01-2003, 05:27 AM
just do this
newwin=window.open("","","scrollbars,toolbar")

hothousegraphix
06-01-2003, 06:40 AM
Thanks for responding!

I guess I'm a little tired. Simply missed it.

Let me ask you this - with this script I'm using, I still have to add two additional screen resolutions (1024x768, and I believe 1600x1280).

When I add a third "window.open" action I'm getting two popups opening, rather than just the one I want, for the first to conditions (800x600, 1024x768)

Any clue how to fix?

This is what I have so far:
[code]
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
//800 x 600//
if ((screen.width == 800) && (screen.height == 600)){
var targeturl="http://www.cartoonnetwork.com/"
newwin=window.open("","","scrollbars")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}
//or else 1024 x 768//
else if ((screen.width == 1024) && (screen.height == 768)){
var targeturl="http://www.msn.com"
newwin=window.open("","","scrollbars")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}

//or else 1280 x 1024//
else if ((screen.width == 1280) && (screen.height == 1024))
var targeturl="http://www.hothousegraphix.com/tests/Hhg2Layout.html"
newwin=window.open("","","scrollbars,toolbar")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}

// End -->
// -->
[code]

glenngv
06-02-2003, 06:25 AM
you missed the opening curly brace...

else if ((screen.width == 1280) && (screen.height == 1024)) {

you can make a generic function to open a popup...




function openPopup(targeturl,features){
newwin=window.open("","",features);
if (document.all){
newwin.moveTo(0,0);
newwin.resizeTo(screen.width,screen.height);
}
newwin.location=targeturl;
}


and call it like this:



if ((screen.width == 800) && (screen.height == 600))
openPopup("http://www.cartoonnetwork.com","scrollbars");
...
else if ((screen.width == 1280) && (screen.height == 1024))
openPopup("http://www.hothousegraphix.com/tests/Hhg2Layout.html","toolbar,scrollbars");
...


that's more efficient and easier to understand..

arnyinc
06-02-2003, 02:56 PM
If you open a popup the size of my monitor, I'll shake my fist at you and never come to your site again. Seriously, that is incredibly annoying.

I attempt to close the window and the extra pixel or two allows me to close the window behind yours, which is actually maximized. Not to mention I have to shutdown every single browser window in order to reset my browser to whatever size I want.

If your site is worthless spam that you only expect people to visit once, you have the right idea though.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum