Facebook
From Smelly Kitten, 3 Months ago, written in JavaScript.
This paste is a reply to Untitled from Perl Pheasant - view diff
Embed
Download Paste or View Raw
Hits: 99
  1. <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> <SCRIPT LANGUAGE = "JavaScript"> <!-- Ukrycie przed przeglądarkami nie obsługującymi JavaScriptów var wyrazenie = ""; var nowe = true; function wprowadz (wartosc){ var wyswietlacz = document.kalkulator.wyswietlacz; if (nowe){ nowe = !nowe; wyswietlacz.value = ""; } wyswietlacz.value += wartosc; wyrazenie += wartosc; } function dzialanie (wartosc){ var wyswietlacz = document.kalkulator.wyswietlacz; wyswietlacz.value = ""; wyrazenie += wartosc; } function oblicz (){ var wyswietlacz = document.kalkulator.wyswietlacz; if (wyrazenie != "");{ wyswietlacz.value = eval (wyrazenie); wyrazenie = wyswietlacz.value; nowe = true; } } function zeruj(){ wyrazenie = ""; document.kalkulator.wyswietlacz.value = ""; } function kwadrat(){ if (wyrazenie != ""){ document.kalkulator.wyswietlacz.value = wyrazenie * wyrazenie; wyrazenie = document.kalkulator.wyswietlacz.value; nowe = true; } } // Koniec kodu JavaScript --> </SCRIPT> </HEAD> <BODY> <BR> <BR> <FORM NAME = "kalkulator"> <INPUT TYPE = "text" NAME = "wyswietlacz" SIZE = "13"> <BR> <BR> <TABLE BORDER = "0"> <TR><TD> <INPUT TYPE = "button" NAME = "7" VALUE = " 7 " onClick = "wprowadz(7)"> <INPUT TYPE = "button" NAME = "8" VALUE = " 8 " onClick = "wprowadz(8)"> <INPUT TYPE = "button" NAME = "9" VALUE = " 9 " onClick = "wprowadz(9)"> <INPUT TYPE = "button" NAME = "/" VALUE = " / " onClick = "dzialanie('/')"> </TD></TR><TR><TD> <INPUT TYPE = "button" NAME = "4" VALUE = " 4 " onClick = "wprowadz(4)"> <INPUT TYPE = "button" NAME = "5" VALUE = " 5 " onClick = "wprowadz(5)"> <INPUT TYPE = "button" NAME = "6" VALUE = " 6 " onClick = "wprowadz(6)"> <INPUT TYPE = "button" NAME = "*" VALUE = " * " onClick = "dzialanie('*')"> </TD></TR><TR><TD> <INPUT TYPE = "button" NAME = "1" VALUE = " 1 " onClick = "wprowadz(1)"> <INPUT TYPE = "button" NAME = "2" VALUE = " 2 " onClick = "wprowadz(2)"> <INPUT TYPE = "button" NAME = "3" VALUE = " 3 " onClick = "wprowadz(3)"> <INPUT TYPE = "button" NAME = "-" VALUE = " - " onClick = "dzialanie('-')"> </TD></TR><TR><TD> <INPUT TYPE = "button" NAME = "0" VALUE = " 0 " onClick = "wprowadz(0)"> <INPUT TYPE = "button" NAME = "!" VALUE = "^2" onClick = "kwadrat('^2')"> <INPUT TYPE = "button" NAME = "c" VALUE = " c " onClick = "zeruj()"> <INPUT TYPE = "button" NAME = "+" VALUE = " + " onClick = "dzialanie('+')"> </TD></TR><TR><TD> <INPUT TYPE = "button" NAME = "=" VALUE = " = " onClick = "oblicz()"> </TR></TD> </TABLE> </FORM> </BODY> </HTML>