Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Someone help me with the following code: Use your editor to open the bc_fed_txt.html and bc_keys_txt.js files from the html12 ? review folder. Enter your

Someone help me with the following code:

Use your editor to open the bc_fed_txt.html and bc_keys_txt.js files from the html12 ? review folder. Enter your name and the date in the comment section of each file, and save them as bc_fed.html and bc_keys.js respectively.

2

Go to the bc_fed.html file in your editor. Directly above the closing tag, link the page to the bc_keys.js JavaScript file, loading the file asynchronously. Take some time to study the contents of the HTML file and then close it, saving your changes.

3

Go to the bc_keys.js file in your editor. Add event listeners to run the findKeyWords() and makeKeyStyles() functions when the page is loaded.

4

Create the findKeyWords() function to locate the keywords from the document and generate the keyword list. Within the findKeyWords() function, perform the tasks described in steps 5 through 10.

5

Create an aside element with the ID keywords and containing an h1 heading with the text Keyword List.

6

Create an ol element and append it to the keywords aside element.

my code won't work:

js:

"use strict";

/*

New Perspectives on HTML5, CSS3 and JavaScript 6th Edition

Tutorial 12

Review Assignment

Author:

Date:

Filename: bc_keys.js

Functions

=========

findKeyWords()

Locate the keywords in the article indicated by the tag

and add those keywords in alphabetical order to a keyword box.

makeKeyStyles()

Create an embedded style sheet for the keyword box.

replaceWS(textStr)

Replaces occurences of one or more consecutive white space

characters with the _ character.

*/

/* functions when the page is loaded */

window.addEventListener ("load", findKeyWords, makeKeyStyles);

function findKeyWords() {

var keywords = document.getElementById("keywords");

var source = document.getElementById("doc");

var mainHeading = document.createElement("h1");

var keywordList = document.createElement("ol");

var headingText = document.createTextNode("KeywordList");

mainHeading.appendChild(headingText);

keywords.appendChild(mainHeadingText);

keywords.appendChild(keywordList);

}

/* Supplied Functions */

function replaceWS(textStr) {

var revText = textStr.replace(/\s+/g,"_");

return revText;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions