[Help need] Auto refresh DIV after 1 sec ?

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

[Help need] Auto refresh DIV after 1 sec ?

Post by spamyboy »

Could some one help, I'm trying to make DIV, that would auto refresh after second, any tutorials/links or etc. pleas.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

could you give my short e.g. couse I'm not good on JS.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

my posts on createElement may be of interest.
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

nop, extualy it didnt, pleas any help, some one :|
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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>
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

doesnt work
==========
edited: work's, thanks :)
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Still need some help with.....?

What are you, specifically, trying to do? What's the goal of this code/functionality?
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

just pull the hash count, thats it
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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).
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

maybe you can give me some: links/tutorials ..
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Post Reply