public_html/testy.html

59 lines
2.1 KiB
HTML
Raw Normal View History

2019-06-14 19:38:05 +02:00
<html>
<head>
<title>Artur Tamborski</title>
<meta charset="utf-8">
<style type="text/css">
body {
background: #2980B9;
background: -webkit-linear-gradient(to right, #FFFFFF, #6DD5FA, #2980B9);
background: linear-gradient(to right, #FFFFFF, #6DD5FA, #2980B9);
}
h4 {
text-align: center;
}
</style>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script>
<script>
window.onload = function() {
alert('s449376');
window.onbeforeunload = function(e) {
return 's449376 leaving';
};
document.getElementById('button').addEventListener('click', function(e) {
var op = document.getElementById('op').value;
var left = Number(document.getElementById('left').value);
var right = Number(document.getElementById('right').value);
var result = document.getElementById('result');
switch (op) {
case 'add': result.value = left + right; break;
case 'sub': result.value = left - right; break;
case 'mul': result.value = left * right; break;
case 'div': result.value = left / right; break;
}
});
}
</script>
</head>
<body>
<div>
<h4>example mathjax:</h4>
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$
</div>
<div>
<input type="text" id="left">
<select id="op">
<option value="add">+</option>
<option value="sub">-</option>
<option value="mul">*</option>
<option value="div">/</option>
</select>
<input type="text" id="right">
<button id="button">Policz</button>
</br></br>=<input type="text" id="result" readonly="readonly">
</div>
</body>
</html>