JavaScript for previous.html