You need to modify the webpage to invoke the JavaScript function named someEvent()

You troubleshoot a webpage that contains the following HTML markup: (Line numbers are included
for reference only.)

The webpage also contains the following JavaScript function named someEvent() that is declared in
the HEAD section of the HTML:
<code>
Function someEvent() {
Alert(‘someEvent fired!’);
}
</code>
The JavaScript function named someEvent() must run only when the user clicks the DIV element, not
the INPUT elements.
You need to modify the webpage to invoke the JavaScript function named someEvent().
What should you do? (Each correct answer presents a complete solution. Choose two.)

You troubleshoot a webpage that contains the following HTML markup: (Line numbers are included
for reference only.)

The webpage also contains the following JavaScript function named someEvent() that is declared in
the HEAD section of the HTML:

Function someEvent() {
Alert('someEvent fired!');
}

The JavaScript function named someEvent() must run only when the user clicks the DIV element, not
the INPUT elements.
You need to modify the webpage to invoke the JavaScript function named someEvent().
What should you do? (Each correct answer presents a complete solution. Choose two.)

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 13

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


hus

hus

The answer is A and C

jam

jam

I think that correct answers are a) and c) too

Alida

Alida

I’ve checked – correct answers are A and C

rik

rik

At first I thought A and C were correct, simply because B and D are clearly wrong. Then I looked it up, and now I’m positive. (From http://javascript.info/tutorial/bubbling-and-capturing)

When you click an html element, its click event fires. This event then ‘bubbles up’ to its first parent, firing the parents click event, and then the next parent all the way up to . (If no handler is defined for the click event of any of the element or parents, nothing happens).
The element that started the event bubbling (the element that was clicked) can be targeted with ‘event.srcElement’ (for internet explorer) or ‘event.target’ (all other browsers).

A:
A handler may decide that the event is fully processed and stop the bubbling. For all browsers except IE <9 this is done with ‘event.stopPropagation’. For IE<9 it is event.cancelBubble.

C:
By using ‘this’ on the parent DIV, ‘el’ represents the parent DIV element. So only if the element that was clicked === the parent div, the alert will pop up.

rik

rik

All the way up to <html>

F

F

C its not right. Look at this fiddle: http://jsfiddle.net/fxwporxu/4/
(note that it just works because I put “this.target” instead of just “target”)

So, without the “this.” the answer C its not right :/

F

F

I mean “event.”

bhanu

bhanu

there is spelling mistake in ur code
var targe intead of target

Arnold

Arnold

The correct answer is A & B.

mieke

mieke

So it is A&B?

banshee

banshee

A&C are correct.

Marsi

Marsi

We all agree that A is correct.
I did try B and it does not work. D is clearly wrong, so it leaves C which I believe must be poorly coded as mentioned above but it should be the right answer.

click for source

click for source

Pretty! This was an incredibly wonderful post. Thank you for supplying this info.|