Update script.js

added key handler