1.

Which of the following is a way of embedding Client-side JavaScript code within HTML documents?(a) From javascript:encoding(b) External file specified by the src attribute of a “script” tag(c) By using a header tag(d) By using body tagI got this question during an online interview.I need to ask this question from Embedding JavaScript in HTML topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

The CORRECT ANSWER is (b) External file SPECIFIED by the src attribute of a “script” tag

For explanation: The Client-side JavaScript code is EMBEDDED within HTML documents in four WAYS :

Inline, between a pair of “script” tags

From an external file specified by the src attribute of a “script” tag

In an HTML event handler attribute, such as onclick or onmouseover

In a URL that uses the special javascript: protocol.



Discussion

No Comment Found

Related InterviewSolutions