how to handle javascript alerts