added javascript for checking user input