Page 1 of 2

[Help need] Auto refresh DIV after 1 sec ?

Posted: Thu Aug 10, 2006 10:57 am
by spamyboy
Could some one help, I'm trying to make DIV, that would auto refresh after second, any tutorials/links or etc. pleas.

Posted: Thu Aug 10, 2006 11:06 am
by Christopher
You just need to combine chaning the inner HTML of a div with the code to do a timer. Use the setTimeout() function to call your div updater function.

Posted: Thu Aug 10, 2006 11:08 am
by spamyboy
could you give my short e.g. couse I'm not good on JS.

Posted: Thu Aug 10, 2006 1:07 pm
by feyd
my posts on createElement may be of interest.

Posted: Fri Aug 11, 2006 6:43 am
by spamyboy
nop, extualy it didnt, pleas any help, some one :|

Posted: Fri Aug 11, 2006 7:12 am
by Weirdan

Code: Select all

<div id='content'>some content</div>
<script type='text/javascript'>
window.load = function() {
    var counter = 0;
    window.setInterval(function() {
        document.getElementById('content').innerHTML = (counter++).toString();
    }, 1000);
};
</script>

Posted: Fri Aug 11, 2006 9:02 am
by spamyboy
doesnt work
==========
edited: work's, thanks :)

Posted: Fri Aug 11, 2006 10:44 am
by spamyboy
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


bo, I still need some help:

Code: Select all

<html>
<head>
<script type='text/javascript'>
window.load = function() {
window.onload = load;
    var counter = 0;
    window.setInterval(function() {
        document.getElementById('content').innerHTML = (counter++).toString();
    }, 1000);
};
</script> 
</head>

<body>
<div id='content'><?php
echo rand() . "\n";
echo rand() . "\n";

echo rand(5, 15);
?></div>
</body>
</html>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Aug 11, 2006 10:52 am
by feyd
Still need some help with.....?

What are you, specifically, trying to do? What's the goal of this code/functionality?

Posted: Fri Aug 11, 2006 3:05 pm
by spamyboy
Ok here is what I got
http://85.206.235.15:12/md5/
you see those number ?
(need help with JS >>> 7848487)
I need to make them refresh svry second (only that div)
as you see those numbers shows curent number of md5 combinations
When I will upload it to server, and run one perl script witch randomly add's new md5 comb, those numbers will change evry second... wel I hope you got the point.

Posted: Fri Aug 11, 2006 3:16 pm
by feyd
okay, so are you wanting to pull the hash count from the server or just linearly increment the display on the page without interaction with the server?

Posted: Fri Aug 11, 2006 3:25 pm
by spamyboy
just pull the hash count, thats it

Posted: Fri Aug 11, 2006 3:27 pm
by feyd
You've now jumping into needing Ajax. You'll need a script that can return just the hash count and get yourself an Ajax library (there are many).

Posted: Fri Aug 11, 2006 3:40 pm
by spamyboy
maybe you can give me some: links/tutorials ..

Posted: Fri Aug 11, 2006 3:45 pm
by Weirdan