-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents_2.js
More file actions
64 lines (64 loc) · 1.71 KB
/
events_2.js
File metadata and controls
64 lines (64 loc) · 1.71 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const btn = document.querySelector('#v2')
btn.onclick = function () {
console.log("you clicked mee!!!!!!");
console.log("agaain!!!!!!!");
}
function scream() {
console.log("AAAAAAAA");
console.log("bcccccccccc")
}
btn.onmouseenter = scream;
document.querySelector('h1').onclick = function () {
alert('you clicked the h1!')
}
const btns = document.querySelector('#v3');
btns.addEventListener('dblclick', function () {
alert('jine mera dil luteya ')
let input = prompt('type the next lyric');
if (input == 'oho') {
alert('right')
}
else {
alert('wrong');
}
})
const btuns = document.querySelector('#v4');
btuns.addEventListener('click', function () {
alert('jine mera dil luteya ')
let input = prompt('type the next lyric');
if (input == 'oho') {
alert('right')
}
else {
alert('wrong');
}
})
const botuns = document.querySelector('#v5');
botuns.addEventListener('mouseup', function () {
alert('jine mera dil luteya ')
let input = prompt('type the next lyric');
if (input == 'oho') {
alert('right')
}
else {
alert('wrong');
}
})
const bottuns = document.querySelector('#v6');
bottuns.addEventListener('mouseup',scream);
function twist(){
console.log("twist!");
}
function Shout(){
console.log("shout!!");
}
const tass= document.querySelector('#tas');
tass.onclick=twist;
tass.onclick=Shout;
//we can only assign 1 property that is the last property
tass.addEventListener('click',twist);
tass.addEventListener('click',Shout);
//if we use the addEventListener both will execute one after the other
// by using both addEvenetListener and function type we get shout then twist and then shout
const once=document.querySelector('#once');
once.addEventListener('click',Shout,{once:true});