Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    Chicago, IL
    Posts
    131
    Thanks
    3
    Thanked 0 Times in 0 Posts

    New Window Properties

    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"?

    Code:
    
    <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>
    

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just do this
    newwin=window.open("","","scrollbars,toolbar")

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    Chicago, IL
    Posts
    131
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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]

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    you missed the opening curly brace...

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

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


    Code:
    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:

    Code:
    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..

  • #5
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •