CIT 171 Chapter 5 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which statement about the nodes created by the following HTML code is true? <html> <head> <title>My Dog Ketchup</title> </head> <body> <h1>Adorable Doggie Snaps</h1> <p>Ketchup plays <em>outside</em></p> </body> </html>

The body element's child nodes are an h1 element and a p element.

Suppose that you have already written JavaScript code to create a parent div element called timeCapsule with several child elements as your web page's main structure. What happens if you call the following method? timeCapsule.appendChild(timeCapsule.firstElementChild;

The first child element node of timeCapsule becomes its last child element node.

How are node properties related to inline styles?

You can define individual styles in JavaScript by appending the style property and a style value to an object.

You are writing an anonymous JavaScript function that should be run when the autoPlay element is clicked. What statement(s) should you place in the blank if you would like the advanceOne function to be called immediately and then called repeatedly at two-second intervals after that? let myAutoComm; autoPlay.onclick = function() { _____ }

advanceOne(); myAutoComm = window.setInterval(advanceOne, 2000);

What belongs in the blank in the following JavaScript code if you want to create the document fragment <h1>Weekly Coupons</h1>? let boxTitle = document.createElement("h1"); let boxTitleText = document.createTextNode("Weekly Coupons"); boxTitle._____;

appendChild(boxTitleText)

Imagine that the HTML file for your web page project includes a div element with the id value "cupcake" and you are writing a function to display and rearrange some images within that element. What JavaScript statement would you place in the blank to move the last image within the ccFrosting element to the beginning of the line and shift the other images one position toward the end? let frostingFiles = ["pinkFr.jpg", "blueFr.jpg", "chocFr.jpg"] let frostingCount = frostingFiles.length; function frostCupcake() { let cupCake = document.getElementById("cupcake"); let ccFrosting = document.createElement("div"); cupCake.appendChild(ccFrosting); ccFrosting.id = "ccFrosting"; for (let i = 0; i < frostingCount; i++) { let image = document.createElement("img"); image.src = frostingFiles[i]; ccFrosting.appendChild(image); } function shuffleBack() { _____ } }

ccFrosting.insertBefore(ccFrosting.lastElementChild, ccFrosting.firstElementChild);

Suppose the HTML file for your web page project includes a div element with the id value "cupcake." You are writing a JavaScript function to create a structure for the cupcake element by nesting a title and two other div elements within the cupcake element. What should be placed in the blank to complete this function? function createCupcake() { let cupCake = document.getElementById("cupcake"); let ccTitle = document.createElement("h1"); let ccFrosting = document.createElement("div"); let ccCake = document.createElement("div"); _____ }

cupCake.appendChild(ccTitle); ccTitle.id = "ccTitle";cupCake.appendChild(ccFrosting);ccFrosting.id = "ccFrosting";cupCake.appendChild(ccCake);ccCake.id = "ccCake";

Which JavaScript method will create a node list by selecting all the paragraph element nodes belonging to the narrative class?

document.querySelectorAll("p.narrative");

You can use the statement boxTitle.id = "bigBox"; to attach the id property with the value "bigBox" to a boxTitle node you just created because _____.

every HTML attribute has a corresponding node property that can be entered directly

It is considered a best practice for web apps to open new browser windows in many situations because they are not blocked by the popup blockers built into browsers, they scale well to small mobile devices, and they can display files that are loaded locally on the user's device.

false

The JavaScript navigator.platform property should be used to determine a user's browser application's primary language.

false

The following JavaScript statement will open a new browser window that includes the browser menu bar and toolbar.window.open("http://www.example.com", "New Window", toolbar=0, menubar=0");

false

When the following JavaScript statements have been used to create and position the niftyDiv element, then the statement document.deleteChild(niftyDiv); will remove this div element.let niftyDiv = document.createElement("div");document.body.appendChild(niftyDiv);

false

What is the foundational role of JavaScript code in a typical web app?

managing the operation of and output from the app

Which of the following JavaScript expressions would reference the third element that is a direct child of the node object?

node.children[2]

What does the following JavaScript code accomplish? let surveyForm = window.open(""); let mainHeading = document.createElement("h1"); mainHeading.textContent = "Your Experience"; surveyForm.document.body.appendChild(mainHeading);

opens a new browser window or tab containing only the heading "Your Experience"

Which property or method of the JavaScript location object is used to both load the web page at the URL passed to it and to remove the URL of the current page so that the user cannot use the back button to navigate to it?

replace()

What does the following JavaScript statement do? let timeID = window.setTimeout(logOut, 60000);

runs the logOut function after a 1-minute delay

In the Document Object Model, _____.

the elements, attributes, comments, processing instructions, and text strings of a web document are organized into a hierarchical structure

The JavaScript statement let cupCakeTwin = cupCake.cloneNode(true); will create a deep copy of the node assigned to the cupCake variable, which will include all its descendants, and assign it to the cupCakeTwin variable.

true

The JavaScript statement window.open("http://www.example.com", "Registration Form"); will open a new browser window or tab with the title "Registration Form."

true

When a JavaScript event handler that calls the doSomething() function in response to a click event is attached to an image on a web page, then that image can be referenced from within the doSomething() function using the this object.

true

When writing JavaScript code to automatically move a user backward one page in their visited page history list for the current session, you can use either the window.history.back(); or the window.history.go(-1); command.

true

After you have written and linked a JavaScript file to add several nodes to a web page, you can use any major browser's debugging console to _____.

view the hierarchical structure of the web page's element nodes with their HTML tags and attributes

If the playTime variable in a JavaScript program has been initialized, the id of a timed command has been stored in it, and that timed command has been initiated, which method can be called to stop this timed command?

window.clearInterval(playTime)

Which JavaScript method should you use to ask the user, "Is it okay to schedule the selected appointment?" and obtain a Boolean value of true for "Okay" or false for "Cancel"?

window.confirm()


Kaugnay na mga set ng pag-aaral

CISCO CCNA I - Modules 16 & 17 - Building and Securing a Small Network (Exam Notes)

View Set

IDENTIFICATION METHODS- SEQUENCING, MULTIPLEX, MALDI,COMMERCILA KITS

View Set

Bio 151 Ch 6 (Lipids and Membranes)

View Set

NUR 125 PrepU Chapter 52: Assessment and Management of Patients with Breast Disorders

View Set