-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
41 lines (32 loc) · 1.28 KB
/
script.js
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
var x1 = document.getElementById('x1').innerHTML;
var x2 = document.getElementById('x2').innerHTML;
var x3 = document.getElementById('x3').innerHTML;
var x4 = document.getElementById('x4').innerHTML;
var btn = document.getElementById('btn');
function changeButton(){
btn.innerHTML = "Return";
btn.setAttribute("onclick","returnValues();");
}
function returnValues(){
document.getElementById('x1').innerHTML = x1;
document.getElementById('x2').innerHTML = x2;
document.getElementById('x3').innerHTML = x3;
document.getElementById('x4').innerHTML = x4;
btn.innerHTML = "Result";
btn.setAttribute("onclick","showResult();");
}
function showResult(){
var result = "Fiat" + 147;
document.getElementById('x1').innerHTML = 'x = '+ result;
//-----------------------------------------------------------------
result = "Fiat" + 1 + 4 + 7;
document.getElementById('x2').innerHTML = 'x = '+ result;
//-----------------------------------------------------------------
result = 147 + "Fiat";
document.getElementById('x3').innerHTML = 'x = '+ result;
//-----------------------------------------------------------------
result = 1 + 4 + 7 + "Fiat";
document.getElementById('x4').innerHTML = 'x = '+ result;
//-----------------------------------------------------------------
changeButton();
}