JavaScript Mouse over events

JavaScript Mouse over events

10th - 12th Grade

7 Qs

quiz-placeholder

Similar activities

VB Controls

VB Controls

11th Grade

10 Qs

AIJ XI TKJ

AIJ XI TKJ

11th Grade

10 Qs

Pre-Assessment: ICT 10 Orientation Day

Pre-Assessment: ICT 10 Orientation Day

10th Grade

10 Qs

BÀI TẬP T7 - KHỞI ĐỘNG

BÀI TẬP T7 - KHỞI ĐỘNG

10th - 12th Grade

10 Qs

Input Devices of Computer

Input Devices of Computer

11th Grade

10 Qs

Interstate Competition

Interstate Competition

7th - 10th Grade

11 Qs

Vocabulary Quiz - Computer - 01

Vocabulary Quiz - Computer - 01

12th Grade - University

10 Qs

Немного о файлах и файловой системе

Немного о файлах и файловой системе

8th - 10th Grade

10 Qs

JavaScript Mouse over events

JavaScript Mouse over events

Assessment

Quiz

Computers

10th - 12th Grade

Practice Problem

Medium

Created by

Zain Abaidin

Used 39+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers