Uncategorized

Kalkulator


<html>

<body>

<P style=”color:red; font-size:30px” id=”Izracunaj”>

rezultat

</P>

<input type=”text” id=”broj1″>

<input type=”text” id=”broj2″>

<input type=”button” value=”SABIRA” onclick=”AKCIJA1()”>

<input type=”button” value=”MNOZI ” onclick=”AKCIJA2()”>

<input type=”button” value=”ODUZIMA ” onclick=”AKCIJA3()”>

<input type=”button” value=”DELI ” onclick=”AKCIJA4()”>

</body>

function AKCIJA1() {

X =Number(window.document.getElementById(“broj1”).value)

Y =Number(window.document.getElementById(“broj2”).value)

REZULTAT = X + Y

window.document.getElementById(“Izracunaj”).innerHTML = REZULTAT

}

function AKCIJA2() {

X =Number(window.document.getElementById(“broj1”).value)

Y = Number(window.document.getElementById(“broj2”).value)

REZULTAT = X * Y

window.document.getElementById(“Izracunaj”).innerHTML = REZULTAT

}

function AKCIJA3() {

X =Number(window.document.getElementById(“broj1”).value)

Y = Number(window.document.getElementById(“broj2”).value)

REZULTAT = X – Y

window.document.getElementById(“Izracunaj”).innerHTML = REZULTAT

}

function AKCIJA4() {

X =Number(window.document.getElementById(“broj1”).value)

Y = Number(window.document.getElementById(“broj2”).value)

REZULTAT = X / Y

window.document.getElementById(“Izracunaj”).innerHTML = REZULTAT

}

</html>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s