CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Posts
    228

    Question Refresh a Div...

    Hello,

    I have a page which looks like below:

    Code:
    <html>
    
    <head>
    <title>New Page 1</title>
    </head>
    
    <body>
    
    <div>Test1</div>
    <div>Test2</div>
    <div>Test3</div>
    
    </body>
    
    </html>
    and basicly what I want is, I want to be able to every 5 seconds go and refresh the Div parts.

    For Example:
    in the <div>Test1</div> part I want page1.html to appear and refresh every 5 seconds

    in the <div>Test2</div> part I want page2.html to appear and refresh every 5 seconds

    in the <div>Test3</div> part I want page3.html to appear and refresh every 5 seconds

    anyone know how to do this.

    I am only using Javascript (I am not using PHP or ASP)

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: Refresh a Div...

    If you are not using PHP or ASP (or JSP), only Javascript then every thing is on the client side.
    1. I am not sure you really want to stay on the client side.
    2. If you stay on the client side, you don't need Ajax, because Ajax is used for updating components in the client page with data coming from the server.

    You can set a timer triggering a function that will change the content of your divs with
    Code:
    document.getElementById('id_of_a_div').innerHTML="bla bla";

  3. #3
    Join Date
    Mar 2006
    Posts
    228

    Re: Refresh a Div...

    Im creating a program in Visual Basic which will act as a server and pages will be hosted using this program so its like a mini webserver.

  4. #4
    Join Date
    May 2006
    Posts
    306

    Re: Refresh a Div...

    You could use
    Code:
    <meta content="5" http-equiv="refresh" />
    in page1, page2, and page3.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured