forked from yaelahaiz/hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvinantyo-calculator.html
208 lines (193 loc) · 5.66 KB
/
vinantyo-calculator.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
<!DOCTYPE html>
<html lang="en">
<style>
body {
background-color: #1B1734;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-decoration: none;
color: white;
text-align: center;
}
h1 {
letter-spacing: 4px;
font-size: 50px;
}
h2 {
font-size: 20px;
color: #a89aff;
}
.transbox {
margin: 0 auto;
position: relative;
padding: 20px;
max-width: 680px;
background: rgba(255, 255, 255, .2);
}
.bungkus p {
font-size: 18px;
}
img {
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.30), 0 15px 12px rgba(0, 0, 0, 0.22);
border: 2px transparent;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
margin: 5px;
}
img:hover {
transform: scale(1.15);
box-shadow: 0 14px 28px rgba(255, 255, 255, 0.25), 0 10px 10px rgba(255, 255, 255, 0.22);
}
footer {
margin-top: 5%;
}
p.miring {
font-style: italic;
font-size: 18px;
}
p.bold {
font-weight: bold;
}
button {
padding: 7px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 200px;
}
button.blue {
background-color: #3498db;
}
button.green {
background-color: #2ecc71;
}
button.orange {
background-color: orangered;
}
table{
margin: 0px auto;
text-align: left;
}
</style>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>15.2</title>
</head>
<script lang="JavaScript">
function tekan()
{
var namastr = (document.fform.nama.value);
var alamatstr = (document.fform.alamat.value);
var kelamin = (document.fform.jenis.value);
var status = (document.fform.status.value);
document.fform.onama.value = namastr;
document.fform.oalamat.value = alamatstr;
document.fform.ojenis.value = kelamin;
document.fform.ostatus.value = status;
alert("Data berhasil di input !");
}
function jumlah(){
var input1 = parseInt((document.fform.input1.value));
var input2 = parseInt((document.fform.input2.value));
var operator = (document.fform.op.value);
var hasil;
if (operator == '+') {
hasil = input1 + input2;
document.getElementById('hasil').innerHTML = '<h2> Hasilnya adalah = ' + hasil, '</h2>';
}
if (operator == '-'){
hasil = input1 - input2;
document.getElementById('hasil').innerHTML = '<h2> Hasilnya adalah = ' + hasil, '</h2>';
}
if (operator == '*'){
hasil = input1 * input2;
document.getElementById('hasil').innerHTML = '<h2> Hasilnya adalah = ' + hasil, '</h2>';
}
if (operator == '/'){
hasil = input1 / input2;
document.getElementById('hasil').innerHTML = '<h2> Hasilnya adalah = ' + hasil, '</h2>';
}
}
</script>
<body>
<form name="fform">
<h1>Pertemuan 15 dan 16</h1>
<div class="transbox">
<table width="60%">
<tr>
<td>Nama Anda</td>
<td><input type="text" name="nama"></td>
</tr>
<tr>
<td>Alamat</td>
<td><input type="text" name="alamat"></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td><input type="radio" name="jenis" value="Pria">Pria <input type="radio" name="jenis" value="Wanita">Wanita</td>
</tr>
<tr>
<td>Status</td>
<td><select name="status">
<option value="Bekerja">Bekerja</option>
<option value="Kuliah">Kuliah</option>
<option value="Bekerja + Kuliah">Bekerja + Kuliah</option>
<option value="Menganggur">Menganggur</option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="kirim" onclick="tekan()"> <input type="reset" value="ulang"></td>
</tr>
<tr>
<td><h2>Hasil</h2></td>
<td></td>
</tr>
<tr>
<td>Jadi Nama anda adalah</td>
<td><input type="text" name="onama" readonly></td>
</tr>
<tr>
<td>Alamat Anda di</td>
<td><input type="text" name="oalamat" readonly></td>
</tr>
<tr>
<td>Jenis Kelamin Anda adalah</td>
<td><input type="text" name="ojenis" readonly></td>
</tr>
<tr>
<td>Status anda saat ini</td>
<td><input type="text" name="ostatus" readonly></td>
</tr>
</table>
<br>
<h2>Program Calculator</h2>
<table width="60%" style="text-align: center;">
<tr>
<td><h2>Nilai 1</h2></td>
<td></td>
<td><h2>Nilai 2</h2></td>
</tr>
<tr>
<td><input type="text" name="input1"></td>
<td><select name="op">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select></td>
<td><input type="text" name="input2"></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="kirim" onclick="jumlah()"><input type="reset" value="ulang" onclick="document.getElementById('hasil').innerHTML = '';"></td>
<td></td>
</tr>
</table>
<div id="hasil"></div>
</div>
</form>
</body>
</html>