Jump to content

Streaming or Auto-Refreshing?


EriRyoutan

Recommended Posts

Hi again.

I'm working on writing a page that keeps getting new content added to it like every few minutes, and i would like it to be either streaming or auto-refreshing. I've heard of it possible with PERL but I'd like to do it using only PHP and/or JavaScript (or HTML, but that's kind of a given)

Thanks for reading, and hope somebody out there has a (simple?) answer.

EDIT: Oh! and does anybody know if $_SESSION[''] $_GET[''] etc, etc. have to be capitalized?
Link to comment
https://forums.phpfreaks.com/topic/7447-streaming-or-auto-refreshing/
Share on other sites

If you aren't particular about whose browsers you support, you may be able to put the Javascript innerHTML property. I don't think browsers other than Gecko-based or IE support it, though.

Here's a quick & dirty demonstration:
[code]<html>
<head>
<script language="javascript">
function increaseCounter()
{
    document.getElementById('testdiv').innerHTML ++;
    setTimeout('increaseCounter();', 1000);
}
</script>
</head>
<body onload="increaseCounter();">
<div id="testdiv">1</div>
</body>
</html>[/code]

Load that in your browser, and see if you can make something useful out of the innerHTML property. I'm sure www.w3schools.com has something they can teach you about it.

And you may also want to check out AJAX - Asynchronous Javascript with XML. It's designed specifically for this purpose. Support the creators of this community and go to [a href=\"http://www.ajaxfreaks.com\" target=\"_blank\"]http://www.ajaxfreaks.com[/a] for more info. I'm afraid I've got no experience with that, so I can't help there. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.