You need to invoke the clickReporter() JavaScript function when a user clicks the mouse on the canvas HTML element

You troubleshoot a webpage that contains the following HTML element:
<code>
<canvas id= “clickCanvas” width-“300”> height= “300”>Your browser does not support the
HTML5 canvas.</canvas>
</code>
The following JavaScript code is included in a script tag in the HEAD section of the webpage: (Line
numbers are included for reference only.)

You need to invoke the clickReporter() JavaScript function when a user clicks the mouse on the
canvas HTML element.
What should you do?

You troubleshoot a webpage that contains the following HTML element:

<canvas id= "clickCanvas" width-"300"> height= "300">Your browser does not support the
HTML5 canvas.</canvas>

The following JavaScript code is included in a script tag in the HEAD section of the webpage: (Line
numbers are included for reference only.)

You need to invoke the clickReporter() JavaScript function when a user clicks the mouse on the
canvas HTML element.
What should you do?

A.
Add the following attribute to the canvas HTML element:
clicked= “clickReporter()”

B.
Replace the code segment at line 06 with the following code segment:
drawBox.Click += clickReporter;

C.
Insert the following code segment at line 07:
canvas.onclick = clickReporter;

D.
Insert the following code segment at line 07:
canvas, click = clickReporter;



Leave a Reply 9

Your email address will not be published. Required fields are marked *


Wojta

Wojta

Option c is correct.

Option A is wrong since it must have been onlick=”clickReporter()”

M

M

The correct answer is C as the top comment says!

Alida

Alida

I think that the correct answer is A.
You add an attribute to the canvas element – clicked. When the canvas is clicked you should execute clickReporter().
I think that C is not correct because the invoke has to be clickReporter() en not clickReporter.

Al

Al

The correct answer is C. In this case, the parentheses are not required since we are assigning the function (as an object) to the onclick event, rather than defining the function in our assignment, as is the case with the window.onload event.

Vivek

Vivek

I tested, C is correct

Vivek

Vivek

I tested, C is correct.

Lindokuhle

Lindokuhle

C is correct

vamsikrishna

vamsikrishna

c is correct

Po

Po

Option B ahaha. Who would make “drawBox.Click += clickReporter” as valid javascript??