Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: How can I adapt a world-population script to be a cigarettes-smoked script

1. ## How can I adapt a world-population script to be a cigarettes-smoked script

There is a script offered at http://www.javascriptkit.com/script/cutindex10.shtml that shows the count of the present world population. Can someone tell me how to adapt that script so that it will show the number of cigarettes smoked so far this year. The total number of cigarettes smoked in 2007 was 5.608 trillion and we can use the same number for this year. Does anyone know how to do that. It will be very helpful for an anti-smoking page on my website. Thanks.

• Originally Posted by dovidshmuel
There is a script offered at http://www.javascriptkit.com/script/cutindex10.shtml that shows the count of the present world population. Can someone tell me how to adapt that script so that it will show the number of cigarettes smoked so far this year. The total number of cigarettes smoked in 2007 was 5.608 trillion and we can use the same number for this year. Does anyone know how to do that. It will be very helpful for an anti-smoking page on my website. Thanks.

http://www.javascriptkit.com/script/...worldpop.shtml

best regards

• Yes. Sorry, my mistake.

• Originally Posted by dovidshmuel
Yes. Sorry, my mistake.
no problem, it's happend.
What method do you have in mind to compute the numbers?

best regards

• It seems to me that there are 3.1536 billion hundredths-of-a-second in one year. There are 5.608 trillion cigarettes smoked in one year. Therefore, for every 1/100th of a second, there are 1778 cigarettes being smoked. Maybe you could check my calculations. So the numbers should spin and calculate to add 1778 every hundredth of a second. Agree?

• Originally Posted by dovidshmuel
It seems to me that there are 3.1536 billion hundredths-of-a-second in one year. There are `5.608 trillion cigarettes smoked in one year`. Therefore, for every 1/100th of a second, there are 1778 cigarettes being smoked. Maybe you could check my calculations. So the numbers should spin and calculate to add 1778 every hundredth of a second. Agree?
- you ar from us or uk? if I'm not wrong trillion and billion have different meaning in us and uk.
- what is the source for that, how accurate it is?
- simple division is not too simple?

btw, I don't understand why I try to help you, it's against my interest, I'm smoker, I like it and I pay a lot of taxes and support a lot of "helping" **** for that.

best regards

• I am from the US. The count is: hundreds, thousands, millions, billions, trillions. I got the number from WikiAnswers from a Google search. There is a website: http://www.worldometers.info, which lists, among many other things, the number of cigarettes smoked today. It now shows over 12,000,000,000. That is probably a better way to show the figures anyway. But the figures are the same, each 1/100th second, starting at 12:00 midnight, add 1778.
You can think that you are helping me for any people who might wish they could stop smoking and just need one extra little helpful push to get them over the hurdle.

• Originally Posted by dovidshmuel
I am from the US. The count is: hundreds, thousands, millions, billions, trillions. I got the number from WikiAnswers from a Google search. There is a website: http://www.worldometers.info, which lists, among many other things, the number of cigarettes smoked today. It now shows over 12,000,000,000. That is probably a better way to show the figures anyway. But the figures are the same, each 1/100th second, starting at 12:00 midnight, add 1778.
well, I don't trust them, but this is only my opinion, too many people mess with statistics only to increase trafic. I belive in designer responsability for information accuracy and visitors capability to decide what's good for them.
one way is to use setInterval to increase value of a variable. That means to add 1778 each second to the variable and show it in the page.
you can do changes in script to achive that? If not I will try to do it for you.

You can think that you are helping me for any people who might wish they could stop smoking and just need one extra little helpful push to get them over the hurdle.
yes, this is a reason, I agree, Unfortunately is more politics in anti-smoking then real problem like that. Anyway was just a remark, I don't want to transform your thread, a technical issue, into a pros/cons smoking/anti-smoking so I'm off this debate and I will stay with technical stuff as far I could help.

best regards

• I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.

• Originally Posted by dovidshmuel
I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.
I could try, but is not relevant in my opinion. We can see info if is refreshed often then 40 ms, 25 times per second. So 1/10th is probably ok, often is useless and annoying in my opinion.

best regards

• The more often the numbers change, the better, so if you can make it change 25 times per second, that would be great. Therefore, add 7112 every 25th of a second. I would be very appreciative.

• Originally Posted by dovidshmuel
I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.
sounds like you know what you need to do, just not how. It's pretty simple.
I didn't look at the script, but you should be able to add a variable and add 1778 to it every iteration and display it in an element.

var num=1778;

in the loop you will add
num+=1778;

where ever it's doing the readout, you have to give it num

• i don't understand any of the script language so for me it's not easy to do at all. Could you look at the script, change the variable and post the script back to me (but not 1778 as you put in your last answer because that is the number for every second changing and the numbers need to change more rapidly than that, as I listed in my last answer).

• Thank you, TinyScript. Just three additional requests: first, how can I enter that (with different captions) on my website; second, can you get the numbers to change faster, so that it looks like they are constantly changing, rather than now that you can see them jumping to each new number; and three, I need it to start automatically at zero at 0:00 on January 1 of each year and the present number should reflect the number since 1/1/09.

•
Page 1 of 2 12 Last

#### Posting Permissions

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