Open
Description
For anyone interested: This code based on previous lessons from this excellent book will also work for this Event Handler exercise. It uses the setAttribute( x, y) method instead of the image.src object/property/value pathway.
<!doctype html>
<title> Image Guess </title> <style> body { margin: 20px; } img { margin: 20px; } </style> <script> window.onload = init;function init() {
var image = document.getElementById("zero");
image.onclick = showAnswer;
};
function showAnswer() {
var image = document.getElementById("zero").setAttribute("src", "zeroblur.jpg");
}
Metadata
Metadata
Assignees
Labels
No labels