Thursday, January 8, 2015

Simple marquee/ticker in Javascript/HTML

First, here is my code. Second, you can find code to make a marquee here or here.

Third, what I wanted to do was count the number of days since the Chibok girls in Nigeria had been kidnapped by Boko Haram. The main thing for me to figure out was how to count so that the number of days would be updated each day. I discovered Date.parse() and decided to subtract the date of the kidnapping from the current date using Date.parse(). That total is then divided by 86400000 because Date.parse() will give you the number of milliseconds since 1/1/70, so you have to convert that to days. I then used Math.round.

Finally, I just inserted the marquee code.

Now go make a ticker!

No comments:

Post a Comment