popup not poping

Discussion in 'ASP .Net' started by Buz Waitz, Jun 15, 2004.

  1. Buz Waitz

    Buz Waitz Guest

    I have tried several different versions of javascript to pop up a window
    from an aspx page. The problem is, that the new page pops up in the current
    window, not in a popup. The code works in a regular HTML page, using
    Dreamweaver. I've also used code generators, tried by hand, you name it.
    Same result. Here's one version of code I used:

    <script language="javascript" type="text/javascript">
    <!--
    function PT_poppwin(theURL,winName) { //v2.0
    window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    }
    //-->
    </script>

    <a href="listsinfo.aspx" onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    Lists</a>

    Any suggestions on how to pop open a new window? Thanks.

    Buz
     
    Buz Waitz, Jun 15, 2004
    #1
    1. Advertising

  2. Hi Buz,

    try adding return false after your function PT_popwin or that you return
    false from your function PT_popwin always. Like this:

    **************************
    script language="javascript" type="text/javascript">
    <!--
    function PT_poppwin(theURL,winName) { //v2.0
    window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    return false;
    }
    //-->
    </script>

    <a href="listsinfo.aspx" onMouseDown="return
    PT_popwin('listsinfo.aspx','Lists')">Lists</a>

    **************************
    or like this:

    <a href="listsinfo.aspx" onMouseDown="return
    PT_popwin('listsinfo.aspx','Lists');return false;">Lists</a>


    Hope this is useful to you
    Cheers
    Cristian




    "Buz Waitz" <> wrote in message
    news:...
    > I have tried several different versions of javascript to pop up a window
    > from an aspx page. The problem is, that the new page pops up in the

    current
    > window, not in a popup. The code works in a regular HTML page, using
    > Dreamweaver. I've also used code generators, tried by hand, you name it.
    > Same result. Here's one version of code I used:
    >
    > <script language="javascript" type="text/javascript">
    > <!--
    > function PT_poppwin(theURL,winName) { //v2.0
    > window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    > }
    > //-->
    > </script>
    >
    > <a href="listsinfo.aspx"

    onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    > Lists</a>
    >
    > Any suggestions on how to pop open a new window? Thanks.
    >
    > Buz
    >
    >
     
    Cristian Suazo, Jun 16, 2004
    #2
    1. Advertising

  3. Buz Waitz

    bloomfield Guest

    I guess it has something to do with the wrong function name
    in script: PT_poppwin
    in href: PT_popwin

    I also recomand using
    onclick="PT_popwin('listsinfo.aspx','Lists'); return false;"
    and not onMouseDown

    Buz Waitz wrote:
    > I have tried several different versions of javascript to pop up a window
    > from an aspx page. The problem is, that the new page pops up in the current
    > window, not in a popup. The code works in a regular HTML page, using
    > Dreamweaver. I've also used code generators, tried by hand, you name it.
    > Same result. Here's one version of code I used:
    >
    > <script language="javascript" type="text/javascript">
    > <!--
    > function PT_poppwin(theURL,winName) { //v2.0
    > window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    > }
    > //-->
    > </script>
    >
    > <a href="listsinfo.aspx" onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    > Lists</a>
    >
    > Any suggestions on how to pop open a new window? Thanks.
    >
    > Buz
    >
    >
     
    bloomfield, Jun 16, 2004
    #3
  4. Buz Waitz

    Hans Kesting Guest

    "Buz Waitz" <> wrote in message news:...
    > I have tried several different versions of javascript to pop up a window
    > from an aspx page. The problem is, that the new page pops up in the current
    > window, not in a popup. The code works in a regular HTML page, using
    > Dreamweaver. I've also used code generators, tried by hand, you name it.
    > Same result. Here's one version of code I used:
    >
    > <script language="javascript" type="text/javascript">
    > <!--
    > function PT_poppwin(theURL,winName) { //v2.0
    > window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    > }
    > //-->
    > </script>
    >
    > <a href="listsinfo.aspx" onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    > Lists</a>
    >
    > Any suggestions on how to pop open a new window? Thanks.
    >
    > Buz
    >
    >


    Possibly a typing error in your post, but I noticed that the function definition
    uses PT_poppwin (double p), and that you call PT_popwin (single p).

    The current window gets changed because of the "href". As others replied,
    you need to add "return false" to the event handler:
    <a ... onMouseDown="PT_popwin('listsinfo.aspx','Lists'); return false">

    Hans Kesting
     
    Hans Kesting, Jun 16, 2004
    #4
  5. Buz,

    window.showModalDialog (..);

    Eliyahu

    "Buz Waitz" <> wrote in message
    news:...
    > I have tried several different versions of javascript to pop up a window
    > from an aspx page. The problem is, that the new page pops up in the

    current
    > window, not in a popup. The code works in a regular HTML page, using
    > Dreamweaver. I've also used code generators, tried by hand, you name it.
    > Same result. Here's one version of code I used:
    >
    > <script language="javascript" type="text/javascript">
    > <!--
    > function PT_poppwin(theURL,winName) { //v2.0
    > window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    > }
    > //-->
    > </script>
    >
    > <a href="listsinfo.aspx"

    onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    > Lists</a>
    >
    > Any suggestions on how to pop open a new window? Thanks.
    >
    > Buz
    >
    >
     
    Eliyahu Goldin, Jun 16, 2004
    #5
  6. Buz Waitz

    Buz Waitz Guest

    the return false did it. thanks!

    "Buz Waitz" <> wrote in message
    news:...
    > I have tried several different versions of javascript to pop up a window
    > from an aspx page. The problem is, that the new page pops up in the

    current
    > window, not in a popup. The code works in a regular HTML page, using
    > Dreamweaver. I've also used code generators, tried by hand, you name it.
    > Same result. Here's one version of code I used:
    >
    > <script language="javascript" type="text/javascript">
    > <!--
    > function PT_poppwin(theURL,winName) { //v2.0
    > window.open(theURL,winName,'scrollbars=1,width=300,height=600');
    > }
    > //-->
    > </script>
    >
    > <a href="listsinfo.aspx"

    onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
    > Lists</a>
    >
    > Any suggestions on how to pop open a new window? Thanks.
    >
    > Buz
    >
    >
     
    Buz Waitz, Jun 16, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmljYXJkbyBWaWRlaXJh?=

    Poping up a window AND redirecting the page thtat triggered the po

    =?Utf-8?B?UmljYXJkbyBWaWRlaXJh?=, Dec 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    520
    Bruce Barker
    Dec 16, 2005
  2. Satya
    Replies:
    4
    Views:
    12,051
    Satya
    Jan 23, 2006
  3. Gouse
    Replies:
    2
    Views:
    348
    Kenny McCormack
    Dec 4, 2006
  4. Replies:
    11
    Views:
    1,213
    Default User
    Mar 5, 2007
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    552
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page