-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
98 lines (85 loc) · 2.32 KB
/
Copy pathtest.html
File metadata and controls
98 lines (85 loc) · 2.32 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<html>
<head>
<style>
.hilite {
color:red;
}
</style>
</head>
<body>
Hello
<button onclick="highlight(this);debug('fsdfsdfsdfsdf');">ttereer</button>
World
</body>
<script>
function Point(x,y) {
this.x = x;
this.y = y;
}
Point.prototype.r = function() {
return Math.sqrt(
this.x * this.x +
this.y * this.y);
}
Point.prototype.salary=function(){
return this.x;
};
var p = new Point(1,1);
console.log(p.r());
console.log(p.salary());
var test = [1,1];
test.r = function() {
return Math.sqrt(
this[0] * this[0] +
this[1] * this[1]);
}
console.log(test.r());
function debug(msg) {
var log = document.getElementById("qwqwqw");
console.log(log);
if(!log) {
log = document.createElement("div");
log.id = "qwqwqw";
log.innerHTML = "<h1 id='ii' class='hilite'>Debug log</h1>";
document.body.appendChild(log);
}
var pre = document.createElement("pre");
pre.id = "tt";
var text = document.createTextNode(msg);
pre.appendChild(text);
log.appendChild(pre);
}
// debug("222222222");
function hide(e,reflow) {
if(reflow) {
e.style.display = "none";
}else {
e.style.visibility = "hidden";
}
}
// hide(document.getElementById("ii"),false);
function highlight(e) {
console.log((e.className)+"*");
if(!e.className) {
e.className = "hilite";
}else {
e.className += "hilite";
}
}
// highlight(document.getElementById("ii"));
// window.onload = function() {
// var images = document.getElementByTagName("img");
// for (var i = 0; i < images.length; i++) {
// var image = images[i];
// if(image.addEventListener) {
// image.attachEventListener("click",hide,false);
// }else {
// image.attachEvent("onclick",hide);
// }
// function hide(event) {
// event.target.style.vivibility = "hidden";
// }
// };
// }
</script>
</html>