1

I am trying to auto refresh div section in x second. I want that for every x second div sec should display different different content and after displaying last content it should display content from starting

How can I achieve this ?

<script type="text/javascript"
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
    var auto_refresh = setInterval(
        function () {
            $('#push').load('F3.jsp').fadeIn("slow");
        }, 10000); // refresh every 10000 milliseconds
</script>
<div class="push">
    <table  width="100%" border="1" align="center"
            cellpadding="0" cellspacing="1" bordercolor='66A8FF'>
        <%
            int i=5;
            int j=6;
            int k=7;
        %>
        <tr bgcolor="0F57FF" style="border-collapse:collapse">
            <td width="50%" height="50px" align="center" style="font-size:24px">
                <font color="#fff"><%= i%></font>
            </td>   
        </tr>
    </table>
</div>

I want to show value of i,j,k periodically for every x second in the table.

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
user3585120
  • 15
  • 2
  • 8
  • http://stackoverflow.com/questions/1224463/is-there-any-way-to-call-a-function-periodically-in-javascript this link may help you. – Valath Apr 30 '14 at 06:50
  • You'll need to use closing tags for your `tr` and `table`. – Cerbrus Apr 30 '14 at 06:51
  • You dont need neither jsp nor reloading for changing just a number in a cell. Do you really wanna do just this or is there something else going on in `F3.jsp` ? – Batu.Khan Apr 30 '14 at 06:54

1 Answers1

0

This code might help you.

$('.push').html('');
var x= 1000;
var countRefresh = 0;
var contentCount;
counter=setInterval(refreshFun, x);


function refreshFun()
{
    if(countRefresh == contentCount){
        clearInterval(counter);
        counter=setInterval(refreshFun, x);
    }else{
        var i=5;
        var j=6;
        var k=7;
        var table = "{Your table html}";

        $('.push').html(table);
        countRefresh++;
    }

}

Thanks.

nab_kc
  • 56
  • 6