Animal Trading cards


Juda ko‘p hodisalardan saqlaning


Download 5.19 Mb.
bet44/44
Sana12.11.2023
Hajmi5.19 Mb.
#1768393
1   ...   36   37   38   39   40   41   42   43   44
Bog'liq
FrontEnd uz Final

5. Juda ko‘p hodisalardan saqlaning


Savol
Ushbu kod bilan nechta hodisa tinglovchisi yaratiladi?
const myCustomDiv = document.createElement('div');



for (let i = 1; i <= 200; i++) {
const newElement = document.createElement('p');
newElement.textContent = 'This is paragraph number ' + i;


newElement.addEventListener('click', function respondToTheClick(evt) {
console.log('A paragraph was clicked.');
});


myCustomDiv.appendChild(newElement);
}


document.body.appendChild(myCustomDiv);

Hodisa tinglovchilari sonini kiriting. (faqat raqamlar)


Javob:
200
Izoh: har bir sikl yurishida yartilgan obyektga alohida hodisa tinglovchisi tayinlanadi.

6. DOM qachon tayyor bo‘lishini biling


1-savol
DOMContentLoaded hodisasi uchun qaysi hodisa maqsadini tinglashimiz kerak?

Izoh:


DOMContentLoaded hodisasining maqsadi document obyektidir.

2-Laboratoriya:PixelArtMaker

Yechimga na’muna:


“index.html”

“index.html” fayli kodi



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29



Pixel Art Maker!




Pixel Art Maker


Choose Grid Size



Grid Height:

Grid Width:





Pick A Color





Design Canvas






Download 5.19 Mb.

Do'stlaringiz bilan baham:
1   ...   36   37   38   39   40   41   42   43   44




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling