-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut17.js
More file actions
43 lines (36 loc) · 1.12 KB
/
tut17.js
File metadata and controls
43 lines (36 loc) · 1.12 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
// Events & Event Object In JavaScript
console.log("Welcome to tut17")
document.getElementById('headingId1').addEventListener('click', function(e) {
console.log("You have clicked on Pricing");
console.log(e);
let myVar = e.target
console.log(myVar);
myVar = e.target.className
console.log(myVar);
myVar = e.target.classList;
console.log(myVar);
myVar = Array.from(e.target.classList);
console.log(myVar);
myVar = e.target.id;
console.log(myVar);
myVar = e.offsetX;
console.log(myVar);
myVar = e.offsetY;
console.log(myVar);
myVar = e.clientX;
console.log(myVar);
myVar = e.clientY;
console.log(myVar);
// location.href = '//codewithharry.com';
})
let myName = document.getElementById('myName').value;
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("id_of_page2").innerHTML = this.responseText;
}
};
xhttp.open("GET", myName, true);
xhttp.send();
}