-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
197 lines (181 loc) · 5.92 KB
/
index.html
File metadata and controls
197 lines (181 loc) · 5.92 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
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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>さくさく便利機能サイト</title>
</head>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background: #ffd700;
color: white;
padding: 10px 0;
text-align: center;
}
.keisan-calculator {
margin: 20px;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
input[type="text"],
input[type="number"] {
width: 100px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-right: 10px;
}
select {
padding: 10px;
border-radius: 5px;
}
button {
padding: 10px;
background-color: #ffd700;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #cc9706;
}
.weather-container,
.timer-container {
margin: 20px;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
footer {
text-align: center;
padding: 10px;
background: #ffd700;
color: white;
position: relative;
bottom: 0;
width: 100%;
}
keisan-calculator {
input, button {
width: 50px;
height: 50px;
margin: 5px;
font-size: 20px;
}
}
</style>
<script>
// タイマー機能
document.getElementById('start-timer').addEventListener('click', function() {
const minutes = parseInt(document.getElementById('timer-input').value);
const timerResult = document.getElementById('timer-result');
if (!isNaN(minutes) && minutes > 0) {
let time = minutes * 60; // 分を秒に変換
timerResult.innerHTML = `タイマー: ${time}秒`;
const interval = setInterval(() => {
time--;
if (time < 0) {
clearInterval(interval);
timerResult.innerHTML = 'タイマーが終了しました!';
} else {
timerResult.innerHTML = `タイマー: ${time}秒`;
}
}, 1000);
} else {
timerResult.innerHTML = '有効な分数を入力してください。';
}
});
// 計算機機能
document.getElementById('calculate-button').addEventListener('click', function() {
const num1 = parseFloat(document.getElementById('num1').value);
const num2 = parseFloat(document.getElementById('num2').value);
const operator = document.getElementById('operator').value;
const calculationResult = document.getElementById('calculation-result');
let result;
switch (operator) {
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
result = num2 !== 0 ? num1 / num2 : 'エラー: ゼロで割ることはできません';
break;
}
calculationResult.innerHTML = `結果: ${result}`;
});
function appendToResult(value) {
document.getElementById('result').value += value;
}
function clearResult() {
document.getElementById('result').value = '';
}
function calculateResult() {
const resultField = document.getElementById('result');
try {
resultField.value = eval(resultField.value);
} catch (e) {
resultField.value = 'エラー';
}
}
</script>
<body>
<header>
<h1>さくさく便利機能サイト</h1>
</header>
<main>
<div class="keisan-calculator">
<h2>計算機</h2>
<input type="text" id="result" disabled>
<br>
<button onclick="clearResult()">C</button>
<button onclick="appendToResult('7')">7</button>
<button onclick="appendToResult('8')">8</button>
<button onclick="appendToResult('9')">9</button>
<button onclick="appendToResult('/')">/</button>
<br>
<button onclick="appendToResult('4')">4</button>
<button onclick="appendToResult('5')">5</button>
<button onclick="appendToResult('6')">6</button>
<button onclick="appendToResult('*')">*</button>
<br>
<button onclick="appendToResult('1')">1</button>
<button onclick="appendToResult('2')">2</button>
<button onclick="appendToResult('3')">3</button>
<button onclick="appendToResult('-')">-</button>
<br>
<button onclick="appendToResult('0')">0</button>
<button id="calculate-button" onclick="calculateResult()">=</button>
<button onclick="appendToResult('+')">+</button>
</div>
<div class="weather-container">
<h2>今日の天気</h2>
<div id="ww_e1a77263e3b59" v='1.3' loc='auto' a='{"t":"horizontal","lang":"ja","sl_lpl":1,"ids":[],"font":"Arial","sl_ics":"one_a","sl_sot":"celsius","cl_bkg":"image","cl_font":"#FFFFFF","cl_cloud":"#FFFFFF","cl_persp":"#81D4FA","cl_sun":"#FFC107","cl_moon":"#FFC107","cl_thund":"#FF5722"}'>More forecasts: <a href="https://oneweather.org/ja/tokyo/10_days/" id="ww_e1a77263e3b59_u" target="_blank">天気 東京 10日</a></div>
<script async src="https://app3.weatherwidget.org/js/?id=ww_e1a77263e3b59"></script>
</div>
<div class="timer-container">
<h2>タイマー</h2>
<input type="number" id="timer-input" placeholder="分" min="1">
<button id="start-timer">スタート</button>
<div id="timer-result"></div>
</div>
</main>
<footer>
<p>© 2024 さくさく便利機能サイト</p>
</footer>
</body>
</html>