-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent.js
More file actions
71 lines (54 loc) · 1.84 KB
/
Copy pathevent.js
File metadata and controls
71 lines (54 loc) · 1.84 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
65
66
67
68
69
70
71
//1-
// document.getElementById('hlo').addEventListener('click',function()
// {
// console.log("You have clicked")
// // location.href='codewithharry.com';//If we click on element with id hlo then it will send it to codewithharry.com.
// })
//2-
// document.getElementById('hlo').addEventListener('click',function(a)
// {
// console.log("You have clicked")
// let variable;
// // variable=a.target;//It will print the who element in which you have targetted.
// // variable=a.target.className;
// // variable=a.target.classList;
// // variable=a.target.id;
// variable=a.offsetX;
// variable=a.offsetY;
// variable=a.clientX;
// variable=a.clientY;
// console.log(variable)
// // location.href='codewithharry.com';//If we click on element with id hlo then it will send it to codewithharry.com.
// })
//More on event listeenrs.
//1-
// let btn=document.getElementById('fo');
// btn.addEventListener('mouseover',func1)
// btn.addEventListener('click',func2)
// btn.addEventListener('dblclick',func3)
// btn.addEventListener('',func4)
// function func1() {
// console.log("Hello bro")
// }
// function func2() {
// console.log("It is a click")
// }
// function func3()
// {
// console.log("It is a double clcik")
// }
//2-
// document.querySelector('.child').addEventListener('mouseenter',function()
// {
// console.log("You have entered");
// })
// document.querySelector('.child').addEventListener('mouseleave',function()
// {
// console.log("You get exit");
// })
// document.querySelector('.container').addEventListener('mousemove',function(e)
// {
// console.log(e.offsetX,e.offsetY);//prints the offset when the event will occur.
// document.body.style.backgroundColor=`rgb(${e.offsetX},${e.offsetY},${e.offsetX+e.offsetY})`;//For styling.
// console.log("You trigerred");
// })