Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how do I make a webpage reopen itself on close? #2

    I saw that someone posted this question before and I thought I would try and write a script to do it.


    Can someone tell me why this DOES NOT work:
    <html>
    <head>
    <title></title>
    <script language="Javascript">
    <!--
    function openWindow()
    {
    var openWindow = window.open(test.html);
    }
    //-->
    </script>
    </head>
    <body onUnLoad="openWindow();">
    test
    </body>
    </html>


    But this script DOES work:

    <html>
    <head>
    <title></title>
    <script language="Javascript">
    <!--
    function alertMessage()
    {
    alert("fsfasfsffsadfsadfdasf");
    }
    //-->
    </script>
    </head>
    <body onUnLoad="alertMessage();">
    test
    </body>
    </html>

    I am just curious. Thanks.

    -Dave
    PROWEBWORKS.NET

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    people hate pop-uping. expecially when u want to close certain page..

  • #3
    Regular Coder
    Join Date
    Jan 2005
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I totally agree, I don't plan to use it, I am just curious why it doesn't work.

  • #4
    New Coder
    Join Date
    Jan 2005
    Location
    England
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    function, not variable

    Opening a window is a function (it does something), not a variable (storing a value). So having it as a variable would not work.
    Congratulations on discovering the hidden sig! Click here to claim your prize!

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    You missed the quotes.

    function openWindow()
    {
    var openWindow = window.open("test.html");
    }


  •  

    Posting Permissions

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