CSCE 102 Exam 3 2.0

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/62

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:43 PM on 4/11/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

63 Terms

1
New cards

What is JavaScript

A scripting language used to make web pages interactive

2
New cards

What is an event handler

JavaScript code triggered by events like click or hover

3
New cards

What is alert()

Displays output to the user

4
New cards

What is prompt()

Takes input from the user

5
New cards

Difference between alert and prompt

Alert displays output; prompt takes input

6
New cards

Example of prompt

Age = prompt("Enter your age");

7
New cards

What type of statement is Age = prompt(…)

Assignment statement

8
New cards

Example of alert with variable

alert(Age + " Oh so young!");

9
New cards

Change background color

document.body.style.backgroundColor = "blue";

10
New cards

What is a function

A block of code that runs only when called

11
New cards

When is a function executed

When it is called

12
New cards

Function syntax

function name() { }

13
New cards

Function with one parameter

function name(x) { }

14
New cards

Function with two parameters

function name(x,y) { }

15
New cards

How to call a function

name();

16
New cards

What is a parameter

A value passed into a function

17
New cards

Where do parameters get values

From the function call

18
New cards

What is concatenation

Joining strings using +

19
New cards

Example of concatenation

alert(x + y);

20
New cards

What is document.getElementById

Selects an element by its id

21
New cards

Change text of element

document.getElementById("id").innerHTML = "text";

22
New cards

Change style of element

document.getElementById("id").style.color = "blue";

23
New cards

Change image

document.getElementById("id").src = "image.jpg";

24
New cards

What does .value do

Gets or sets value of textbox

25
New cards

Example get textbox value

document.getElementById("box1").value

26
New cards

Example set textbox value

document.getElementById("box1").value = x

27
New cards

Why use parseFloat

Converts string to number for math

28
New cards

Example parseFloat

parseFloat(document.getElementById("box1").value)

29
New cards

What does Math.random do

Generates number between 0 and 1

30
New cards

What does Math.round do

Rounds a number

31
New cards

Example random + round

var x=Math.random(); var y=Math.round(x);

32
New cards

If statement syntax

if(condition){ }

33
New cards

Else statement

Runs if condition is false

34
New cards

Equal operator

==

35
New cards

Not equal operator

!=

36
New cards

Greater than

>

37
New cards

Less than

<
38
New cards

AND operator

&&

39
New cards

OR operator

||

40
New cards

Modulus operator

%

41
New cards

Example even/odd

if(x % 2 == 0)

42
New cards

What is this keyword

Refers to current element

43
New cards

Change color using this

this.style.color="red";

44
New cards

Change text using this

this.innerHTML="New text";

45
New cards

Change image using this

this.src="cat.jpg";

46
New cards

onclick event

Runs code when clicked

47
New cards

onmouseover event

Runs when mouse is over element

48
New cards

onmouseout event

Runs when mouse leaves element

49
New cards

Textbox HTML

<input type="text" id="box1">

50
New cards

Button HTML

<input type="button" value="click">

51
New cards

Function to add two numbers

function add(a,b){ alert(a+b); }

52
New cards

Calling add function

add(2,4);

53
New cards

What happens with Sum("2","4")

It concatenates to "24"

54
New cards

What happens with parseFloat

It converts to numbers so math works

55
New cards

Swap variables

var temp=a; a=b; b=temp;

56
New cards

Image rollover

<img src="dog.jpg" onmouseover="this.src='cat.jpg'">

57
New cards

Change background with function

function bg(){ document.body.style.backgroundColor="yellow"; }

58
New cards

Function with parameter background

function bg(x){ document.body.style.backgroundColor=x; }

59
New cards

Call background function

bg("blue");

60
New cards

Checkbox difference

Can select multiple options

61
New cards

Radio button difference

Only one option can be selected

62
New cards

Checkbox check

if(document.getElementById("box1").checked)

63
New cards

Radio check

if(document.form.cat[1].checked)