antiblock
https://arwen2.global/
  • Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
proestrela

Script De Relogio: Ajuda!

4 posts in this topic

Boas pessoal, tou aqui com um problema no script do relogio php...Ele não me atuliza os segundos, já tentei meter a funsão

header('resfresh: 1')

mas assim ele atualiza-me a pagina toda de 1 em 1 segundo, e não me dá geito

 

Queria apenas atualizar o relogio de 1 em 1 segundo e não a pagina toda :D

 

aqui fica o codigo do relógio

 

<?phpdate_default_timezone_set('Atlantic/Azores');echo 'Hora: ' . date('H:i:s') . ' Data: ' . PHP_EOL;$date = date('m/d/Y h:i:s', time()); // not sure what this is doing!echo date('d/m/Y', time());?>

 

Com os melhores cumprimentos de ρэdяø™ λκλ јuηκĩэ

Share this post


Link to post
Share on other sites
antiblock
https://arwen2.global/

Não é possível tendo o código do relógio em PHP, terias de fazer em Ajax.

Share this post


Link to post
Share on other sites

Usa Javascript/ajax.

Share this post


Link to post
Share on other sites

Obrigado pelas dicas pessoal, deixo aqui o codigo para quem precisar:

 

JavaScript colocar entre: <head></head>

function ur_start(){    UR_Nu = new Date;    UR_Indhold = showFilled(UR_Nu.getHours()) + ":" + showFilled(UR_Nu.getMinutes()) + ":" + showFilled(UR_Nu.getSeconds());    document.getElementById("ur").innerHTML = UR_Indhold;    setTimeout("ur_start()",1000);}function showFilled(Value){    return (Value > 9) ? "" + Value : "0" + Value;}

Função body:

Substituir<body>por<body onload="ur_start()">

Codigo do relógio: Hora: H:M:S Data: D/M/A

<?phpdate_default_timezone_set('Atlantic/Azores');echo 'Hora: ' . '<font id="ur" font-size="3" face="Trebuchet MS, Verdana, Arial, sans-serif" color="#DAD3B7"></font> ' . ' Data: ' . PHP_EOL;$date = date('m/d/Y h:i:s', time());echo date('d/m/Y', time());?>

Code by ρэdяø™ λκλ јuηκĩэ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this