Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.javascript > #8029

Re: date server

From Alex <tommaso5ita@yahoo.it>
Newsgroups it.comp.lang.javascript
Subject Re: date server
Date 2016-04-29 16:57 +0200
Organization Netfront http://www.netfront.net/
Message-ID <nfvsoh$hnm$1@adenine.netfront.net> (permalink)
References <nfvfe9$4bm$1@dont-email.me>

Show all headers | View raw


Scriveva M_M venerdì, 29/04/2016:
> Vorrei mettere nell'homepage un orologio con la data ed ora del server
> aggiornandola continuamente (mi bastera` ogni minuto), per cui, credo ma
> me ne intendo veramente poco..., che occorra usare anche PHP.
>
> Prendendo spunto da questo esempio di orologio lato client, in
> javascript,:
>
> http://www.elated.com/articles/creating-a-javascript-clock/
>
> ho provato a fare uno script che richiama la data del server tramite PHP:
>
> <html>
> <head>
> <script type="text/javascript">
> <!-- 
> function updateClock()
> {
>  var currentTimeString = "<?php echo date('l jS \of F Y h:i:s A'); ?>"
>  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
> }
> -->
> </script>
> </head>
> <body onload="updateClock(); setInterval('updateClock()', 1000 )">
>  <span id="clock">&nbsp;</span>
> </body>
> </html>
>
> ma stampa la data ma poi non si aggiorna.
>
> Potete darmi un aiuto per risolvere per favore?
>
> Ho provato a togliere dal body
> onload="updateClock(); setInterval('updateClock()', 1000 )"
> e ad aggiungere nello script:
>
> window.onload=function(){
>   setInterval("updateClock()", 1000)
> }
>
> ma purtroppo anche cosi` nulla e` cambiato.

Ehh, ti tocca interrogare sempre il server per avere la data.
Chiamate ajax.

Bye

-- 
Alex

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Back to it.comp.lang.javascript | Previous | NextPrevious in thread | Find similar


Thread

date server M_M <spam@the.hell> - 2016-04-29 13:13 +0200
  Re: date server Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-29 14:14 +0100
    Re: date server M_M <spam@the.hell> - 2016-04-29 17:12 +0200
      Re: date server M_M <spam@the.hell> - 2016-04-29 19:25 +0200
        Re: date server M_M <spam@the.hell> - 2016-04-30 09:26 +0200
          Re: date server M_M <spam@the.hell> - 2016-05-03 14:15 +0200
  Re: date server Alex <tommaso5ita@yahoo.it> - 2016-04-29 16:57 +0200

csiph-web