Jump to content

Refresh Div


Choutz
 Share

Recommended Posts

Boas, estava a tentar fazer um refresh na div a cada 1 segundo, mas não está a funcionar.

O objetivo era ele dar refresh a váriavel, porque estão sempre acontecer jogos.

Pode estar um pouco confuso porque sou novo nisto soz. 😛

<div class="col-sm-3">
<div class="bg">
<center> Games today </center>
 <br><br>
 <script language="javascript">
 var gamesplayed = document.getElementById('games-played-today');
 window.setInterval("refreshDiv()", 1000);
 function refreshDiv(){
 document.getElementById("games-played-today-real").innerHTML = gamesplayed;
 }
</script>
 <center><div class="info" id="games-played-today-real"></div></center>
</div>
Edited by Choutz
Link to comment
Share on other sites

E o que está na #games-played-today muda?

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Não. O que tu estás a fazer é copiar o valor que está num elemento HTML e colocá-lo noutro elemento HTML. Daí eu ter perguntado se o #games-played-today muda.

Se o #games-played-today não existe, então é normal que nada aconteça.

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
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
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.