SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Refreshing element in web page

    On a web page, I need a paragraph to refresh every second. I'm learning JavaScript and will eventually learn AJAX, but I want to add this feature in my site right away. Could someone please help me with the code? Thanks a lot!

    Here's the code - the PHP just generates the current date.

    Code:
    <p id="time"><?php echo date("l, F j, Y g:i:sa");// This PHP generates the current time... ?></p>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,676
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    It can be difficult to perform live communications with your PHP code from the web page.
    You can make your life a lot easier by using a clock that is known to work well, such as from http://timeanddate.com/clocks/free.html
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •