refined javascript input