html JS Flashcards

1
Q

How is JavaScript embedded inside an HTML page?

A

We can create a
“”

in head or body. We can define functions here and these functions can be called by button onClick event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do u get developer tools in a browser?

A

Right click on the page, choose ‘inspect’.

or,
CTL Shift j

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In developer tools, how can various web page elements be accessed?

A

By using “document” object, which represents current web page displayed in the browser.
We can print the value of “title” by typing,
document.title
in the console.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do u access a web page’s elements in JavaScript?

A

By assigning elements an id, and accessing them in JS using getElementById(“id”);

<h1>Taaza Khhabar</h1>

document.getElementById(“headline”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a quick way to get an output msg from a web page.

A
use alert("ABCD");
in a JavaScript.

u can also use console.log(“ABCD”);
This will appear in developer console.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do u associate an event listener to a button.

A

By calling

buttonID.addEventListener(‘click’, function);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to get chrome developer tools?

A

Right click on the page, and select “inspect”
or
press F12 key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly