1.

What is the JavaScript code snippet to update the content of the timestamp element when the user clicks on it?(a) timestamp.onLoad = function() { this.innerHTML = new Date().toString(); }(b) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }(c) timestamp.onload = function() { this.innerHTML = new Date().toString(); }(d) timestamp.onclick = function() { innerHTML = new Date().toString(); }The question was posed to me in final exam.Question is from JavaScript in Web Browsers in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct ANSWER is (b) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }

The best I can explain: onclick() function is used to handle events when the user clicks on the mouse. The above CODE snippet updates the content of the timestamp ELEMENT when the user clicks on it.



Discussion

No Comment Found

Related InterviewSolutions