update
This commit is contained in:
26
javascript/szamok/index.html
Normal file
26
javascript/szamok/index.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Szamok</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="szamok">
|
||||
<button id="gomb0" onclick="szam(this)">0</button>
|
||||
<button id="gomb1" onclick="szam(this)">1</button>
|
||||
<button id="gomb2" onclick="szam(this)">2</button>
|
||||
<button id="gomb3" onclick="szam(this)">3</button>
|
||||
<button id="gomb4" onclick="szam(this)">4</button>
|
||||
<button id="gomb5" onclick="szam(this)">5</button>
|
||||
<button id="gomb6" onclick="szam(this)">6</button>
|
||||
<button id="gomb7" onclick="szam(this)">7</button>
|
||||
<button id="gomb8" onclick="szam(this)">8</button>
|
||||
<button id="gomb9" onclick="szam(this)">9</button>
|
||||
</div>
|
||||
<button id="negyzet" onclick="negyzet()">Negyzet</button>
|
||||
<div id="eredmeny"></div>
|
||||
<div id="eredmeny2"></div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
12
javascript/szamok/script.js
Normal file
12
javascript/szamok/script.js
Normal file
@@ -0,0 +1,12 @@
|
||||
let szamok = "";
|
||||
|
||||
function szam(element){
|
||||
//document.getElementById("eredmeny").innerHTML = element.innerText;
|
||||
szamok += element.innerText;
|
||||
document.getElementById("eredmeny2").innerHTML = "Eddigi szam: " + szamok;
|
||||
}
|
||||
|
||||
function negyzet(){
|
||||
let negyzeten = parseInt(szamok) * parseInt(szamok);
|
||||
document.getElementById("eredmeny").innerHTML = "Eredmeny: " + negyzeten;
|
||||
}
|
||||
Reference in New Issue
Block a user