Microsoft Exam Questions

You are developing an HTML page that includes the following code.

You are developing an HTML page that includes the following code.

<h1 id=-header->A Static Page</hl>

You need to modify the content of the H1 element dynamically by using JavaScript.

Which code segment should you use?



A. Option A

B. Option B

C. Option C

D. Option D

Explanation:

innerHTML

The innerHTML property sets or returns the HTML content (inner HTML) of an element.

Example

Change the HTML content of a

<

h1

>

element with id=-header-:

document.getElementById(-header-).innerHTML = -A dynamic page-;

Reference: HTMLDOM innerHTML Property