Which of the following will change the entire body of the HTML on a webpage to the text "Hacked by JavaScript"
JavaScript Basics

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Richard Ghiorse
Used 4+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
document.innerHTML = "Hacked by JavaScript";
document.body = "Hacked by JavaScript";
document.body.innerHTML = "Hacked by JavaScript";
body = "Hacked by JavaScript";
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following JavaScript commands will change the HTML associated with any id "title" to the text "ECS is Fun".
document.title.innerHTML = "ECS is Fun";
document.getElementById("title").innerHTML = "ECS is Fun";
document.getElementById(title).innerHTML = ECS is Fun;
document.getElementById("title") = "ECS is Fun";
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly uses a JavaScript variable that is initialized to 42?
var num = 42;
num = 42;
var 42;
var 42 = num;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following stores all the HTML elements with the tag h2 into a variable called headings?
var headings = document.getElementsByTagName("h2");
var headings = getElementsByTagName("h2");
var headings = document.getElementsByTagName(h2);
headings = document.getElementsByTag(h2);
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose we have the following JavaScript variable to retrieve all the paragraphs on a webpage:
var paragraphs = document.getElementsByTagName("p");
Which of the following changes the text of the second paragraph to "The second paragraph has been hacked!"
paragraphs[2] = "The second paragraph has been hacked!";
paragraphs[1] = "The second paragraph has been hacked!";
paragraphs[2].innerHTML = "The second paragraph has been hacked!";
paragraphs[1].innerHTML = "The second paragraph has been hacked!";
Similar Resources on Quizizz
10 questions
Prog. Front End - Progressive Enhancement

Quiz
•
11th Grade
10 questions
Java Script

Quiz
•
10th - 12th Grade
10 questions
Java Script

Quiz
•
9th Grade
10 questions
Rec. Mat.II (Programacao)

Quiz
•
9th - 12th Grade
10 questions
Website Design

Quiz
•
KG - University
8 questions
HTML Requests

Quiz
•
9th - 12th Grade
10 questions
Intro to HTML

Quiz
•
9th - 12th Grade
10 questions
JavaScript Cert Prep

Quiz
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade