-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
192 lines (174 loc) · 6.85 KB
/
index.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Hello!
</title>
<script>
function greet()
{
let name = document.querySelector('#que').value;
if (name === '') name = 'nothing';
alert('Are you sure you want to search for ' + name + '?');
document.querySelector('#newName').innerHTML += ', ' + name + '!';
}
let counter = 0;
function increment()
{
counter++;
document.querySelector('#result').innerHTML = counter;
}
// document.querySelector('#red').onclick = function(){
// document.querySelector('body').style.background-color = red;
// }
function blink()
{
let body = document.querySelector('body');
if (body.style.visibility === 'hidden')
{
body.style.visibility = 'visible';
}
else
{
body.style.visibility = 'hidden';
}
}
// window.setInterval(blink, 500);
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="d-flex flex-row">
<div class="p-2">
<div class="vertical-menu">
<a href="index2.html">Introduction Page</a>
<a href="blinker.html">Blinking Page</a>
<a href="index.html" class="active">Incremental Logic</a>
<a href="#">Text / Background manipulator</a>
<!--<a href="#">Link 4</a>-->
</div>
</div>
<div class="p-2">
<div id="scrollbody">
<h1>Hello, world!</h1>
<h2>Subsection 1</h2>
<p class="green title">This is some text</p>
<h2>Subsection 2</h2>
<p class="green">This is some more text</p>
<table>
<tr class="rowheader">
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
<tr>
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
<tr>
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
</table>
<br>
<div class="alert alert-primary" role="alert" style ="width:100px ">
A simple primary alert—check it out!
</div>
<form onsubmit="greet();" action="http://www.google.com/search" method="get">
<input name="q" type="text" id="que">
<input type="submit" value="Search the web">
</form>
<form onsubmit="increment(); return false;">
<input type="submit" value="Increment">
</form>
<div id="newName">Hello</div>
<div id="result">0</div>
<div id="colors">
<button value="red" id="red">R</button>
<button value="green" id="green">G</button>
<button value="blue" id="blue">B</button>
<button value="white" id="white">W</button>
</div>
<br>
<select>
<option value="none" selected disabled hidden>Select an Option</option>
<option value="large">Large Text</option>
<option value="initial">Medium Text</option>
<option value="small">Small Text</option>
</select>
<br>
<div id="p">
<button id="geo">Get Location</button>
</div>
<button id="blinker">BLINK</button>
<button id="stopBlink">STOP BLINK</button>
</div>
</div>
</body>
<script>
document.querySelector('#red').onclick = function()
{
document.querySelector('body').style.backgroundColor = 'red';
};
document.querySelector('#blue').onclick = function()
{
document.querySelector('body').style.backgroundColor = 'blue';
};
document.querySelector('#green').onclick = function()
{
document.querySelector('body').style.backgroundColor = 'green';
};
document.querySelector('#white').onclick = function()
{
document.querySelector('body').style.backgroundColor = 'white';
};
document.querySelector('select').onchange = function(){
const firstList = document.querySelectorAll("p");//.style.fontSize = this.value;
let something = this.value;
firstList.forEach(function(item)
{
item.style.fontSize = something;
// document.write(item.textContent + ' ' + something);
});
};
let limiter = 0;
document.querySelector('#geo').onclick = function()
{
// document.querySelector('body').style.backgroundColor = 'lightgreen';
// var t = document.querySelector('#geo');//.textContent;
// t += "---ADDED";
// var y = document.createTextNode("ADDED");
// t.appendChild(y);
if (limiter===0)
{
limiter++;
navigator.geolocation.getCurrentPosition(function(position)
{
let t = document.getElementById('p');//.textContent;
let y = document.createTextNode(position.coords.latitude+", "+position.coords.longitude);
t.appendChild(y);
// let z = "---ADDED";
// t += "---ADDED";
// var t = document.querySelector('#geo');//.textContent;
// var y = document.createTextNode(" : " + position.coords.latitude + ", " + position.coords.longitude);
// t.appendChild(y);
}
);
}
};
let blinkint=0;
document.querySelector('#blinker').onclick = function(){
blinkint=1;
};
document.querySelector('#stopBlink').onclick = function(){
blinkint=0;
};
window.setInterval(
function(){
if (blinkint===1) blink();
}, 1000);
</script>
</html>