Pop Window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Atkinson

    Pop Window

    I've installed the following Javascript on my Web page and it
    is working fine. It brings up a little pop up message (not an ad).

    <script language="JavaS cript"><!--
    window1=window. open('sera.html ','messageWindo w1','scrollbars =no,width=150,h eight=245')
    //--></script>

    I'd like to make the following improvements:

    1. I want to control where the pop up window
    appears (so it doesn't pop up over the best
    part of the page). Is there any way to
    specify how many pixels from the top and to
    the right that the upper left corner of the
    pop up window should appear?
    2. I want to make the pop up window remain on top
    of the main page until the pop up window is
    closed.
    3. I want the pop up window to close after
    fifteen to thirty seconds.

    Can anyone tell me how to do this?


    Fred

  • Amr Mostafa

    #2
    Re: Pop Window

    Fred Atkinson <fatkinson@mish mash.com> wrote in message news:<45ba10pep sv3mjdq797s46pv e06eb2nch8@4ax. com>...[color=blue]
    > I've installed the following Javascript on my Web page and it
    > is working fine. It brings up a little pop up message (not an ad).
    >
    > <script language="JavaS cript"><!--
    > window1=window. open('sera.html ','messageWindo w1','scrollbars =no,width=150,h eight=245')
    > //--></script>
    >
    > I'd like to make the following improvements:
    >
    > 1. I want to control where the pop up window
    > appears (so it doesn't pop up over the best
    > part of the page). Is there any way to
    > specify how many pixels from the top and to
    > the right that the upper left corner of the
    > pop up window should appear?
    > 2. I want to make the pop up window remain on top
    > of the main page until the pop up window is
    > closed.
    > 3. I want the pop up window to close after
    > fifteen to thirty seconds.
    >
    > Can anyone tell me how to do this?
    >
    >
    > Fred[/color]


    hello,

    1.
    you can use :
    window1=window. open('sera.html ','messageWindo w1','scrollbars =no,width=150,h eight=245.
    top=XXX, left=XXX')
    and replace XXX with the offset you want

    2.
    to do this you need the new window to be a dialog. ( because you can
    control its model/modeless )
    more info here : http://www.webreference.com/js/column90/6.html


    3.
    you need to do make a timer that fires after 30 seconds and call
    window.close()

    more info:





    hope that was helpful

    regards,
    Amr Mostafa

    Comment

    • Grant Wagner

      #3
      Re: Pop Window

      Fred Atkinson wrote:
      [color=blue]
      > I've installed the following Javascript on my Web page and it
      > is working fine. It brings up a little pop up message (not an ad).
      >
      > <script language="JavaS cript"><!--
      > window1=window. open('sera.html ','messageWindo w1','scrollbars =no,width=150,h eight=245')
      > //--></script>
      >
      > I'd like to make the following improvements:
      >
      > 1. I want to control where the pop up window
      > appears (so it doesn't pop up over the best
      > part of the page). Is there any way to
      > specify how many pixels from the top and to
      > the right that the upper left corner of the
      > pop up window should appear?[/color]

      The 3rd parameter of window.open() contains the attributes of the newly opened window, two
      of the available attributes are top and left, of course, you must realize you will have no
      idea where the browser window is on the user's screen, or where the "best part of the
      page" resides, so knowing you can open the popup someplace else is pointless, because you
      could open the popup at 700 x 500, and it *still* might be covering the "best part of the
      page" because of where the user's browser window is positioned and where he is scrolled
      to.
      [color=blue]
      > 2. I want to make the pop up window remain on top
      > of the main page until the pop up window is
      > closed.[/color]

      This can't be done reliably. Some people try to make it happen with <body
      onblur="window. focus();"> but that just breaks the usability of the end-user's browser.
      [color=blue]
      > 3. I want the pop up window to close after
      > fifteen to thirty seconds.[/color]

      <body onload="var t = setTimeout('win dow.close();', 30000);">
      [color=blue]
      > Can anyone tell me how to do this?[/color]

      All of the above assumes you'll even be able to open the window in the first place. If
      it's an unrequested popup, most browsers and many add-ons for browsers that don't support
      it natively now block unrequested new windows. In a browser like Opera, you will simply
      *not* be able to place the popup where you want it, and in attempting to do so, may place
      it somewhere inaccessible to the user.

      In general, popups are a bad idea, find another way to present the content you want the
      user to see.

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available at:
      * http://devedge.netscape.com/library/...ce/frames.html
      * Internet Explorer DOM Reference available at:
      * http://msdn.microsoft.com/workshop/a...ence_entry.asp
      * Netscape 6/7 DOM Reference available at:
      * http://www.mozilla.org/docs/dom/domref/
      * Tips for upgrading JavaScript for Netscape 7 / Mozilla
      * http://www.mozilla.org/docs/web-deve...upgrade_2.html


      Comment

      • @SM

        #4
        Re: Pop Window



        Fred Atkinson a *crit :[color=blue]
        >
        > I've installed the following Javascript on my Web page and it
        > is working fine. It brings up a little pop up message (not an ad).
        >
        > <script language="JavaS cript"><!--
        > window1=window. open('sera.html ','messageWindo w1','scrollbars =no,width=150,h eight=245')
        > //--></script>
        >
        > I'd like to make the following improvements:
        >
        > 1. I want to control where the pop up window
        > appears (so it doesn't pop up over the best
        > part of the page). Is there any way to
        > specify how many pixels from the top and to
        > the right that the upper left corner of the
        > pop up window should appear?[/color]

        top=xxx xxx = the correct value for top margin betwen internal top hedge of screen
        and external top hedge of popup
        left=yyy same for left margin

        attributes = 'scrollbars=no, width=150,heigh t=245,top=xxx,l eft=yyy';
        window1=window. open('sera.html ','messageWindo w1',attributes) ;
        [color=blue]
        > 2. I want to make the pop up window remain on top
        > of the main page until the pop up window is
        > closed.[/color]

        <body onblur="self.fo cus();">
        [color=blue]
        > 3. I want the pop up window to close after
        > fifteen to thirty seconds.[/color]

        <body onblur="self.fo cus();" onload="setTime out('self.close ()',30000);">



        --
        ******** (enlever/remove [OTER_MOI] du/from reply url) *******
        Stéphane MORIAUX : mailto:stephane OTER_MOImoriaux @wanadoo.fr
        Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)

        *************** *************** *************** *************** **

        Comment

        Working...