Using JavaScript for periodically refreshing a page can be quite annoying, as the entire page reloads time to time. Hence, a better option would be to use AJAX...
Read this post on ajinkyamandhare.blogspot.com