ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
2 marks · JavaScript mouse events
A feature is to be added to an online shopping website that allows the user to click on the image of a product to see a different, larger, image of the same product. An example of the intended effect is shown below. after click earBuds2.jpg before click earBuds1.jpg The code used to implement this feature is shown below. JavaScript Code function changePic() { document.getElementById("budPic").style.height="200px"; document.getElementById("budPic").style.width="200px"; } CSS Code #budPic {height: 100px; width; 100px;} HTML Code <p> Click on the image below to see it in more detail. </p> <img src="earBuds1.jpg" id="budPic"> State two reasons why this code is not fit for purpose.
Award 1 mark for each bullet. • Does not change to another image • Function not called/no onClick event/code
Previous question: Higher Computing Science 2023 Question 15