68 users online (0 members and 68 guests)  

Thread: Popup Window


  Results 1 to 3 of 3

Related

  1. Popup-like window    Forum: HTML Forum
    Replies: 0
  2. Problem with popup window    Forum: Javascript Forum
    Replies: 0
  3. positioning a popup window    Forum: HTML Forum
    Replies: 1
  4. popup window    Forum: HTML Forum
    Replies: 1
  5. Popup window to fit?    Forum: HTML Forum
    Replies: 1
  1. #1
    Sean Ridgeway's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2001
    Location
    Stockton, Middlesbrough, England
    Posts
    1

    Question Popup Window

    Hi

    How can I get a popup window to open in the top left hand corner of a web page, and make sure the window opens just enough for the user to see two lines of text.

    Thanx

    Sean

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Cool

    Heres some code, I have not used positioning as I am pretty sure that the default is to popup in the top left of the page -
    This goes pretty much anywhere, but I put it in the head -

    function popUp() {
    var win = window.open("targetpage.html", null, "height=20 width=150 resizable=yes");
    }

    And then you call it by -

    <a href="javascript opUp()">Pop me up!</a>

    Instead of using a target page, you can also have the function write the new popup page itself. Here is one I use which makes a popup mail form -

    function mail() {
    var win = window.open("", null, "height=250 width=300 resizable=yes");
    win.document.write("<body bgcolor=' #6666ff'><h1>Apply for Newsletter</h1><form action='mail.php' method='post'><input type='text' name='email'> Your email<br><input type='submit' value='Join mailing List'></form><form><input type='button' value='close' onClick='self.close()'></form></body>");
    }

    Only thing to watch using document.write, is that you have to have it all on the same line, i.e. no carriage returns. Unless, that is, you concatenate the different lines. Also, use ' instead of ", or else it thinks that the instruction is over.

    Does that make sense? Post if not.

    Laters,

    ------------------
    QuietDean-

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Post

    Grrr

    that should be a : next to a p, not :P

    Also, don't forget to surround your functions with -

    <script language="JavaScript">
    <!--
    {script}
    //-->
    </script>



Tags for this Thread