Jump to content
just-for-funn

Html Refresh Code?

Recommended Posts

Posted

Bun, deci am un table, ex mai jos, si asi vrea ca atunci cand dau click pe "Button01" daca este cumva posibil, vreau ca toate celelalte cell`s de pe randul ala sa isi dea refresh.

Aveti careva idee cum ais putea face, am cautat pe diferite site-uri dar nu am gasit nimic sa mearga ... :(


<table border="1" bordercolor="black" style="background-color:grey" width="355" cellpadding="1" cellspacing="1">
<tr>
<td>Button01</td>
<td>Button02</td>
</tr>
<tr>
<td>Refresh01</td>
<td>Refresh02</td>
</tr>
<tr>
<td>Refresh01</td>
<td>Refresh02</td>
</tr>
<tr>
<td>Refresh01</td>
<td>Refresh02</td>
</tr>
</table>

Posted

Va trebui sa faci requesturi ajax ca sa obtii rezultatul unei pagini. Exemplu:

pagina1.html care contine codul, tabelul, etc cu tot cu scriptul ajax.


<script type="text/javascript">
function checkPlayer()
{
var http;
if (window.XMLHttpRequest)
{
http = new XMLHttpRequest();
}
else
{
http = new ActiveXObject("Microsoft.XMLHTTP");
}

http.onreadystatechange = function()
{
if (http.readyState == 4)
{
document.getElementById('player1').innerHTML = http.responseText;
}
}

http.open("GET", "pagina2.html", true);
http.send();
}
</script>
<span id="player1">Looking for realm</span>
<input type="button" value="Button01" onclick="checkPlayer();">

si pagina2.html care contine doar raspunsul care sa fie afisat in celulele de tabel:


Realm 1337

Le pui pe server si testezi.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...