JavaScript Mouse over events

JavaScript Mouse over events

10th - 12th Grade

7 Qs

quiz-placeholder

Similar activities

pwpb kuis 1

pwpb kuis 1

9th - 12th Grade

10 Qs

informatika asik

informatika asik

10th Grade

10 Qs

Summatif Informatika Sistem Komputer Kelas 10

Summatif Informatika Sistem Komputer Kelas 10

10th Grade

10 Qs

html-form

html-form

3rd Grade - University

11 Qs

Web Development

Web Development

8th - 10th Grade

12 Qs

Basic HTML Tags I

Basic HTML Tags I

9th - 12th Grade

11 Qs

CMU CS3

CMU CS3

9th - 11th Grade

10 Qs

HTML

HTML

12th Grade

11 Qs

JavaScript Mouse over events

JavaScript Mouse over events

Assessment

Quiz

Computers

10th - 12th Grade

Medium

Created by

Zain Abaidin

Used 39+ times

FREE Resource

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a mouse event?

onmousescroller

onclick

onmouseover

onmousemove

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the HTML tag for start of javascript code

<js>

<javascript>

<java>

<script>

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct place to insert JavaScript ?

The <body> section

The <head> section

Both <body> section and the <head> section are ok

Neither <body> section nor the <head> section - they should be in a separate file

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When is the mouseover event fired?

When mouse is moved over a new element

When mouse is clicked

When mouse is both moved and clicked

When mouse is released

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these will increase the value of the variable X?

increment (x)

x++;

x=x;

x+1;

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Pick right answer


<head>

<script type="text/javascript">

function OnMouseIn (elem) {

elem.style.border = "2px solid blue";

}

function OnMouseOut (elem) {

elem.style.border = "";

}

</script>

</head>

<body>

<div style="background-color:#d0f0a0; width:200px"

onmouseover="OnMouseIn (this)" onmouseout="OnMouseOut (this)">

Move your mouse pointer into and out of this element!

</div>

</body>

Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

What is the border color of div when mouse move over the the div?


let bx;

let by;

let boxSize = 75;

let overBox = false;

let locked = false;

let xOffset = 0.0;

let yOffset = 0.0;


function setup() {

createCanvas(720, 400);

bx = width / 2.0;

by = height / 2.0;

rectMode(RADIUS);

strokeWeight(2);

}


function draw() {

background(237, 34, 93);


// Test if the cursor is over the box

if (

mouseX > bx - boxSize &&

mouseX < bx + boxSize &&

mouseY > by - boxSize &&

mouseY < by + boxSize

) {

overBox = true;

if (!locked) {

stroke(255);

fill(244, 122, 158);

}

} else {

stroke(156, 39, 176);

fill(244, 122, 158);

overBox = false;

}


// Draw the box

rect(bx, by, boxSize, boxSize);

}


function mousePressed() {

if (overBox) {

locked = true;

fill(255, 255, 255);

} else {

locked = false;

}

xOffset = mouseX - bx;

yOffset = mouseY - by;

}

unction mouseDragged() {

if (locked) {

bx = mouseX - xOffset;

by = mouseY - yOffset;

}

}


function mouseReleased() {

locked = false;

}

Purple

Red

Orange

White