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
JS Practice: ITS Certification

Quiz
•
12th Grade
10 questions
web tasarım programlama-1

Quiz
•
12th Grade
10 questions
Website Design

Quiz
•
KG - University
10 questions
Tipos de datos JavaScript

Quiz
•
9th - 11th Grade
10 questions
Programação Front End - Lidando com JavaScript limitado

Quiz
•
11th Grade
10 questions
JavaScript & CSS & HTML

Quiz
•
10th Grade
10 questions
HTML Quiz

Quiz
•
12th Grade
10 questions
Evaluasi dan Refleksi - 2

Quiz
•
12th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University