SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Window popup function

    function test1(){
    window.open('about:blank','TEST','width=300,height=300,resizable=1');
    }
    function test2(){
    window.open('about:blank','TEST','width=300,height=400,resizable=1');
    }

    I create 2 buttons and set onclick to test1() , test2() respectively but I tried to click on button1 (call test1()) and click on button2 (call test2()) the windows popup which call from test2() has height=300. I want to popup with height =400 and I don't want to close window popup which call from test1().

    Please help me.

    Step
    1. Call test1 function (the windows's popup width = 300 ,height=300)
    2. Call test2 function (the windows's popup width = 300 , height =300 <= I want height =400)

    Sorry about my grammar.

    Thank you very much

  2. #2
    Google Engineer polvero's Avatar
    Join Date
    Oct 2003
    Location
    Mountain View
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to give them separate names appropriately. since you named them both 'TEST', it will simply replace the window when you invoke another window.open.

  3. #3
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, Thank you but I want to reference to same windows .

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not this with only function by passing the parameters to the function.
    Code javascript:
    function openNewWindow(url, winName, width, height){
          window.open(url,winName,'width=' + width + ',height=' + height + ',resizable=1');
    }

    And call this function:
    HTML Code:
    <a href="javascript:void(null);" onClick="openNewWindow('./page1.html', 'WinA', 300, 400);">Click</a>
    <a href="javascript:void(null);" onClick="openNewWindow('./page2.html', 'WinB', 400, 300);">Click</a>
    Oh, Thank you but I want to reference to same windows .
    What you mean?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No . I want to open popup in same window (both functions have same window name, "TEST") and I want to popup the window different size.

    Reply By "rajug" has different window name "WinA", "WinB" but I want same window name.


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
  •