Results 1 to 4 of 4

Thread: Auto time close and other

  1. #1
    Join Date
    Jan 2006
    Location
    Stephen Island Australia (QLD)
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Auto time close and other

    Hello,
    Please I am looking at a script that can set a html page to close at a certain time.
    I also want the script to gather information from the OS.

    EG. act as a more fancy batch script by useing commands like:
    %USERNAME%
    %time%
    %date%

    The problem is i dont know the html code.

    What is the code for show a username:
    eg. welcome <the user name script> (this is so it will display their username THEY LOGED ON AS)

    The time is <time code>

    Thanks for any help you can provide me with:

    1) auto close script
    2) time code
    3) username code

    THANKS AGAIN

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I also want the script to gather information from the OS.
    The server's OS or the client's OS?
    If the former, you need to use a server-side technology such as PHP. If the latter:
    • The username cannot be gleaned from the OS. This is a security measure and can/should not be bypassed.
    • The time:
      Code:
      <p id="time"></p>
      <script type="text/javascript">
        var timeToClose = "12:15" // 24-hour, no leading zeroes
        onload = updateTime = function() {
          var d = new Date();
          document.getElementById("time").innerHTML = d.getHours() + ":" + d.getMinutes();
          if(document.getElementById("time").innerHTML == timeToClose) window.close();
          window.setTimeout("updateTime()", 1000);
        }
      </script>
      The paragraph can be any text element, but it must have an ID of "time".
    • Auto-close code is in red above. Note that some browsers will ask for confirmation before closing the window.
    Last edited by Twey; 02-14-2006 at 12:07 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Twey,

    Did I miss something or where's this element? :

    document.getElementById("time")
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Whoops, sorry, intended to point that out but forgot. Edited in.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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