1.

What is the code to start displaying the time when the document loads?(a) onload = displayTime;(b) window. = displayTime;(c) window.onload = displayTime;(d) window.onload = start;This question was posed to me in an interview for job.My doubt is from Embedding JavaScript in HTML topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (c) window.onload = displayTime;

The explanation: window.onload is USED to ACCESS the SCREEN while the PAGE is loading. The above code starts displaying the time when the DOCUMENT loads.



Discussion

No Comment Found

Related InterviewSolutions