SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Standardising pop-ups

    I found something in order to create a pop-up window when the user clicks on a link. It all works fine...only the new window doesn't have the normal attributes assigned to the browser window as when opening manually. Can anyone suggest how I would manipulate the following coding so that it has the normal attributes like toolbars, navigation buttons (back, etc), scrollbar, etc???

    Code JavaScript:
    function openwindownew()
    {
    	window.open("http://www.newsite.com/","mywindow","menubar=1,resizable=1,width=400,height=250");
    }

    Code HTML4Strict:
    <a href="javascript: openwindownew()"><img src="image1.jpg" name="link" width="25" height="25" border="0" id="link"/></a>

    _Thanks..

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Opening the window with just the URL defined should do that. Simply:

    Code JavaScript:
    window.open("http://www.newsite.com/");
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    It was my understanding that most of the default items were already "yes" by default.
    http://www.w3schools.com/HTMLDOM/met_win_open.asp
    But I guess it wouldn't hurt to explicitly specify the ones you want to "yes" anyway just to be sure.

  4. #4
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks there.

    It kind of is default when I don't add any specifics and the screen is full but I would like the window to appear smaller so I defined the new window parameters, like this:

    Code JavaScript:
    function openwindowterms()
    {
    	window.open("http://www.newsite.com","menubar=1,resizable=1,"width=350,height=650");
    }

    But this doesn't resize the new window. Can anyone direct me on this as to how to keep the toolbar functions but resize the new window/?? thanks..

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    I'm guessing it's a typo. The window specifications - "specs" - should be in a pair of quotes like
    HTML Code:
    "menubar=1,resizable=1,width=400,height=250"
    not like
    HTML Code:
    "menubar=1,resizable=1,"width=350,height=650"
    It seems "1" should be the same as "true" or "yes", but try using "yes" instead, or leave the ones you want to have use the default values out of it.

  6. #6
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes the typo was just something I wrote here - but for some reason my default settings do not give me a toolbar, scrollbar, etc. I have just included from the link as directed thanks.

    On a slight turn here: has anyone found that the css specs aren't applied when a new window is opened with this method? - my margins are fine when I open a particular page directly but when I do it through this method there are no margins. A little strange I think.

  7. #7
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    It's been resolved - just a case of some technical temperament.

    Thanks for the pushing


Bookmarks

Posting Permissions

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