Pages:
Author

Topic: Help us with a little Javascript (Payment .2 BTC) - page 2. (Read 1311 times)

newbie
Activity: 10
Merit: 0
Can this help you:

http://stackoverflow.com/questions/4572193/how-to-reload-img-every-5-second-using-javascript

Essentially assign a junk parameter to the url so the cache treats it differently and grabs the new data.

You might need to keep 4 id's of images and not rewrite the html inside the div. Directly reference the img tags by id.
member
Activity: 119
Merit: 100
BitcoinMoxy.com
We know it's not an awful lot but we can pay no more at this point. Only do this if you have the spare time!

Take a look at BitcoinMoxy.com. We just added the Bitcoinity minicharts to the page, using a simple script you can switch between the different currencies (USD/EUR/GBP/CAD). Works like a charm, so far so good!

Now we want the charts on display to refresh every 5 or so minutes without reloading the entire page (which is annoying for browsing and it resets the Twitter news feed below). Most people suggest using Ajax for this but we think this can be done using Javascript only.


Something like this or similar:
Code:


The script below (index.html) calls a function in minicharts.js to insert the image links for the default currency USD.
Code:




 

Within each function in minicharts.js there's onclick events that switch to another function (another set of charts, i.e. the anchors to USD,EUR,etc.).

We want this functionality preserved with a simple script (like the one on top) calling the "active" function again with a timer. For this I think every function, when called, should set a global variable to the respective currency and the reload timer should then call that specific function for the currency in the variable.

If I got the theory right, this should reload the images without reloading the page.

Personally, I fail at setting the global variable.. it returns 'undefined', so I give up Smiley

PM or comment below.

Daniel
Pages:
Jump to: