-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcalc.html
117 lines (101 loc) · 2.39 KB
/
calc.html
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html>
<head>
<style type="text/css" media="screen">
textarea,
pre {
margin: 0;
padding: 0;
outline: 0;
border: 0;
}
div#holder{
width:150px;
}
div.b {
width: 50px;
float:left;
border:1px solid black;
text-align:center;
}
.expandingArea {
position:relative;
border:2px solid black;
background:#fff;
width:245px;
}
:target {
-webkit-animation: target-fade 3s 1;
}
@-webkit-keyframes target-fade {
0% { background-color: rgba(255,0,0,.1)}
100% { background-color:rgba(0,0,0,0)}
}
</style>
<title> simple calculator</title>
</head>
<body>
<input id="text"></input><div style="clear:both"></div>
<div id="holder">
<div class="b">1</div>
<div class="b">2</div>
<div class="b">3</div>
<div class="b">4</div>
<div class="b">5</div>
<div class="b">6</div>
<div class="b">7</div>
<div class="b">8</div>
<div class="b">9</div>
<div class="b">0</div>
</div><br />
<div style="clear:both"></div>
<div class="expandingArea">
<pre><span></span><br></pre>
<textarea rows ="2" cols ="32"></textarea>
</div>
<div id='somethingHere'>
<p> Text goes here </p>
</div>
</body>
<a href="#1">Link 1</a>
<a href="#2">Link 2</a>
<a href="#3">Link 3</a>
<div id="1">Paragraph 1</div>
<p id="2">Paragraph 2</p>
<p id="3">Paragraph 3</p>
</html>
<script>
var allDivs = document.getElementsByClassName('b');
console.log(allDivs);
for(var i = 0; i < allDivs.length;i++){
allDivs[i].addEventListener('click', function(){
//alert(this.innerHTML);
input.value += this.innerHTML;
})
}
var input = document.getElementById('text');
input.value = "";
function fade(id){
var el = document.getElementById(id);
console.log(el);
var fadeNum = 1;
el.style.opacity = 1;
function doFade(){
var fadeColor = fadeNum.toString(16);
el.style.backgroundColor = '#ffff' + fadeColor + fadeColor;
if(fadeNum < 16){
fadeNum += 1;
el.style.opacity -= .1;
// console.log(el.style.opacity);
//console.log('in fade function');
setTimeout(doFade, 100);
}else {
el.style.opacity = 0;
}
}
doFade();
}
fade('somethingHere');
window.onscroll = function(){
console.log('scrolling');
}
</script>