updated script.js

Added the input section including input validation