Krsh,
Thank you for using the Science Buddies fora. I am sorry to say that I do not have any experience with JavaScript specifically. However, I have found a link to a helpful resource:
http://www.javascript-coder.com/button/ ... n-p1.phtml.
It is very impressive that you have mastered JavaScript in sixth grade.
Let me know if you need any further assistance. I have a general idea of how I would write the program, so I can help you if necessary.
Good luck,
- Ultra