Which of the following codes inserts text for each item as a hyperlink?

A. var linkElem = document.createElement("a");linkElem.innerHTML =linkElem.setAttribute("href", "#" + n.id);
B. var linkElem = document.createElement("a");linkElem.innerHTML = n.innerHTML;linkElem.setAttribute("href")
C. var linkElem = document.createElement("a");linkElem.innerHTML = n.innerHTML;linkElem.setAttribute("href", "#" + n.id);
D. var linkElem = document.createElement("a");linkElem.setAttribute("href", "#" + n.id);


Answer: C

Computer Science & Information Technology

You might also like to view...

Each parameter in a function header specifies both a(n) ______________ and a(n) ______________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Using the Slice Options dialog box, the ____ box allows you to specify how a link will open -- in a new browser window or as a replacement of the current page.

a. URL b. Paths c. Target d. Window

Computer Science & Information Technology

A webpage you have selected—or is set by default—to display on your computer when you start your browser.

What will be an ideal response?

Computer Science & Information Technology

The string copy function copies the contents of one string, including the null character, to the destination string.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology