Results 1 to 7 of 7

Thread: Switching between windows in ASP - urgent

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Slovenia
    Posts
    40
    Hello
    In my ASP application I open a new window with command
    <SCRIPT>
    window2=window.open("xx.asp","secondwindow")
    </SCRIPT>
    Can anybody know how to close window2 and navigate back to main window (run an ASP in main window) using submit button in window2.
    I tried:
    <FORM action="osp.asp">
    <INPUT type="SUBMIT" name="action" value="Close" onClick="window.close();window.opener.focus">
    </FORM>
    Window2 closes but osp.asp is not executed in main window.

    Best regards,
    Tomaz


  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Just a guess here, but have you tried specifying a target tag in the form

    <FORM action="osp.asp" target="window1">



    I'll have a play with this later if I get time.
    Mark
    -------------------

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Slovenia
    Posts
    40

    switching between windows

    I tried
    <FORM action="osp.asp" target="window1">
    but it opens another browser instance.
    "window1 " is default window adn is not opened by javascript
    window.open().
    I also tried
    <FORM action="osp.asp" target="window.opener">
    but it opens another browser instance too.

    Best regards,
    Tomaz

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Here you are tompod

    load default.htm into your browser...

    default.htm
    Code:
    <html>
    
    
      <frameset cols="*">
        <frame name="main" src="osp.asp">
       </frameset>
      <noframes>
        <p>This page uses frames, but your browser doesn't support them.</p>
      </font></body>
    
    </html>
    osp.asp
    Code:
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <SCRIPT language='Javascript'>
    function OpenPopup(){
    window2=window.open('xx.asp','secondwindow','width=200,height=260')
    }
    </SCRIPT> 
    
    </HEAD>
    <BODY>
    
    <%
    
    dim x
    dim y
    
    x = clng(Request("x"))
    y = clng(Request("y"))
    
    Response.Write "X+Y = "  &  x + y
    Response.Write"<BR><input type=button value='Next' onClick='OpenPopup()'>"
    
    %>
    
    </BODY>
    </HTML>


    xx.asp
    Code:
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    
    </HEAD>
    <BODY>
    <FORM action="osp.asp" target="main"> 
    <input name="x" value=2>
    <input name="y" value=2>
    <INPUT type="SUBMIT" name="action" value="Close" onClick="window.close();window.opener.focus"> 
    
    </FORM> 
    
    <P>&nbsp;</P>
    
    </BODY>
    </HTML>
    Mark
    -------------------

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Slovenia
    Posts
    40

    switching ..

    Thank's Mark!
    I works fine, but there is just one thing. I'm calling this asp from frame page with two frames
    --------------------------
    <html>

    <frameset framespacing="2" rows="50%,50%" frameborder="1">
    <frame name="main1" src="yy.asp">
    <frame name="main2" src="osp.asp">
    </frameset>
    <noframes>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </font></body>

    </html>
    ----------------------------
    I'n this case
    ----------------------------
    <INPUT type="SUBMIT" name="action" value="Close" onClick="window.close();window.opener.focus">
    ----------------------------
    stil opens another browser instance, instead of
    display osp.asp in main window.

    If you know how to fix that I vould be very pleased.

    Thanks and best regards,
    Tomaz

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    do you want osp.asp to
    a)reload into the bottom frame or

    b)reload and replace both frames?

    if a) then it works OK (for me)just make sure you've got main2 as the target

    if b), you'll need another frame page with one frame with the SRC set to the 2-frame frame page....

    Mark
    -------------------

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Slovenia
    Posts
    40
    Thank's Mark
    I've just forgot to specifie "main2" frame as a target.
    Now it works fine.
    You helped me a lot!

    Thank's again!
    Tomaz

Posting Permissions

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



Click Here to Expand Forum to Full Width