What Can JavaScript Do? JavaScript can change HTML attribute values. In this case JavaScript changes the value of the src (source) attribute of an image. Turn on the light onclick="document.getElementById('myImage').src='Turn on the light '">Turn on the lightTurn off the light