-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjava.html
297 lines (236 loc) · 9.18 KB
/
java.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<html>
<head>
<title>Lab</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./img/368604041_840485437510684_2113001665853681955_n.jpg">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="styl.css">
<style>
body,h1,h2,h3,h4,h5,h6 {font-family: "Raleway", sans-serif}
body, html {
height: 100%;
line-height: 1.8;
}
/* Full height image header */
.w3-bar .w3-button {
padding: 16px;
}
</style>
</head>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<body>
<!-- Navbar (sit on top) -->
<div class="w3-top ">
<div class="w3-bar w3-white w3-card" id="myNavbar">
<a href="#home" class="w3-bar-item w3-button w3-wide">LOGO</a>
<!-- Right-sided navbar links -->
<div class="w3-right w3-hide-small">
<a href="#about" class="w3-bar-item w3-button">ABOUT</a>
<a href="index.html" class="w3-bar-item w3-button"><i class="fa fa-user"></i> index</a>
<a href="java.html" class="w3-bar-item w3-button"><i class="fa fa-th"></i> java</a>
<a href="api.html" class="w3-bar-item w3-button"><i class="fa fa-usd"></i> api</a>
<a href="#contact" class="w3-bar-item w3-button"><i class="fa fa-envelope"></i> CONTACT</a>
</div>
<!-- Hide right-floated links on small screens and replace them with a menu icon -->
<a href="javascript:void(0)" class="w3-bar-item w3-button w3-right w3-hide-large w3-hide-medium" onclick="w3_open()">
<i class="fa fa-bars"></i>
</a>
</div>
</div>
<!-- Sidebar on small screens when clicking the menu icon -->
<nav class="w3-sidebar w3-bar-block w3-black w3-card w3-animate-left w3-hide-medium w3-hide-large" style="display:none" id="mySidebar">
<a href="javascript:void(0)" onclick="w3_close()" class="w3-bar-item w3-button w3-large w3-padding-16">Close ×</a>
<a href="#about" onclick="w3_close()" class="w3-bar-item w3-button">ABOUT</a>
<a href="#team" onclick="w3_close()" class="w3-bar-item w3-button">TEAM</a>
<a href="#work" onclick="w3_close()" class="w3-bar-item w3-button">WORK</a>
<a href="#pricing" onclick="w3_close()" class="w3-bar-item w3-button">PRICING</a>
<a href="#contact" onclick="w3_close()" class="w3-bar-item w3-button">CONTACT</a>
</nav>
<!-- Header with full-height image -->
<!-- Contact Section -->
<div class="w3-container w3-light-grey r1 w3-animate-left card" style="padding:128px 16px" id="contact">
<h3 class="w3-center w3-black w3-padding-large w3-padding-32">Code Camp AcademyLab</h3>
<p class="w3-center w3-large w3-red w3-padding-22">js13,js14,js16</p>
<div style="margin-top:150px">
<div class="card">
<h1> Just change A - Z</h1>
<button id="demoButton" >
<p id="demo"></p>
</button>
<h2>แปลงตัวอักษรตัวแรกของ str ให้เป็นตัวพิมพ์ใหญ่ส่วนตัวอักษรที่เหลือให้มีขนาดเหมือนเดิม</h2>
<p>
<label for="inputText">ก่อนแปลง: </label>
<input type="text" id="inputText">
<button onclick="showModifiedString()">แปลง</button>
</p>
<button class="button-one">
<p>หลังแปลง = </p>
<span id="modifiedString" class="output-box" >
<input type="text" id="modifiedString" >
</span>
</button>
<h2>กรุณาคลิกเพื่อแสดงข้อความ</h2>
<p>
<button onclick="myFunction()">คลิก</button>
</p>
<button class="button-one">
<p id="demo2"></p>
</button>
<h2>กรณากรอกเลข</h2>
<label for="inputText">ตัวเลข: </label>
<input type="text" id="numb">
<button type="button" onclick="myFunction2()">ส่ง</button>
<p id="demo3" class="button-two">
<span id="modifiedString" class="output-box" >
<input type="text" id="modifiedString" >
</span>
</p>
<h2>คำนวณแต้มจากยอดซื้อขายโดยเฉพาะทุกยอดซื้อ 100 บาทจะได้ 1 แต้ม</h2>
<input type="text" id="inputTotalSales">
<button onclick="updatePoints()">คำนวณแต้ม</button>
<p>ยอดซื้อขาย:<span id="totalSalesDisplay" ></span> บาท</p>
<p>จำนวนแต้มที่ได้: <span id="loyaltyPointsDisplay"></span> แต้ม</p>
<div>
<canvas id="myChart"></canvas>
<h1>อุณหภูมิแต่ละประเทศ</h1>
<canvas id="myChart1"></canvas>
</div>
</script>
</div>
</div>
<!-- Footer -->
<script src="country-by-religion.json"></script>
<script>
setInterval(() => {
document.getElementById("demoButton").style.backgroundColor = getRandomColor();
}, 1000);
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function printAlphabets() {
const alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
alphabets.split('').forEach((alphabet, index) => {
setTimeout(() => {
document.getElementById("demo").innerHTML = alphabet;
}, index * 1000);
});
}
printAlphabets();
function myFunction() {
document.getElementById("demo2").innerHTML = "Hello World";
}
function myFunction2() {
let x = document.getElementById("numb").value;
let text;
if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document.getElementById("demo3").innerText = text;
}
function ucFirst(str) {
if (!str) return str;
const modifiedStr = str.charAt(0).toUpperCase() + str.slice(1);
return modifiedStr;
}
function ucFirst(str) {
if (!str) return str;
const modifiedStr = str.charAt(0).toUpperCase() + str.slice(1);
return modifiedStr;
}
function showModifiedString() {
const inputText = document.getElementById("inputText").value;
const modifiedString = ucFirst(inputText);
document.getElementById("modifiedString").innerText = modifiedString;
}
function calculateLoyaltyPoints(totalSales) {
let points = totalSales / 100;
points = Math.floor(points);
return points;
}
function updatePoints() {
const newTotalSales = document.getElementById("inputTotalSales").value;
const newPoints = calculateLoyaltyPoints(parseInt(newTotalSales));
if (!isNaN(newPoints)) {
document.getElementById("totalSalesDisplay").innerText = newTotalSales;
document.getElementById("loyaltyPointsDisplay").innerText = newPoints;
} else {
// Handle the error case as needed
console.error("Invalid input. Please enter a valid number.");
}
}
document.getElementById("totalSalesDisplay").innerText = initialTotalSales;
document.getElementById("loyaltyPointsDisplay").innerText = initialLoyaltyPoints;
function calculateCircleLength(radius) {
var PI = Math.PI;
var circleLength = PI * 2 * radius;
return circleLength;
}
function calculateCircleLength(radius) {
var PI = Math.PI;
var circleLength = PI * 2 * radius;
return circleLength;
}
</script>
<script>
const xValues = ["Italy", "France", "Spain", "USA", "Argentina"];
const yValues = [55, 49, 44, 24, 15];
const barColors = ["red", "green","blue","orange","brown"];
new Chart("myChart", {
type: "bar",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
legend: {display: false},
title: {
display: true,
text: "World Wine Production 2018"
}
}
});
// เริ่มโหลดข้อมูล JSON และสร้าง Chart เมื่อโหลดเสร็จสมบูรณ์
fetch('country-by-yearly-average-temperature.json')
.then(response => response.json())
.then(jsonData => {
const labels = jsonData.map(entry => entry.country);
const densities = jsonData.map(entry => entry.temperature);
const ctx = document.getElementById('myChart1').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Average Temperature',
data: densities,
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
});
</script>
</body>
</html>