Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <div id="parinte" class="carcasa">
    <div class="ecran">
      <input type="text" id="nr1" class="nr nr1" value="">
      <input type="text" id="op" class="op" value="">
      <input type="text" id="nr2" class="nr nr2" value="">
    <div class="butoane">
      <button id="1" class="buton numar" value="1">1</button>
      <button id="2" class="buton numar" value="2">2</button>
      <button id="3" class="buton numar" value="3">3</button>
      <button id="plus" class="buton operator" value="plus">+</button>
      <button id="4" class="buton numar" value="4">4</button>
      <button id="5" class="buton numar" value="5">5</button>
      <button id="6" class="buton numar" value="6">6</button>
      <button id="minus" class="buton operator" value="minus">-</button>
      <button id="7" class="buton numar" value="7">7</button>
      <button id="8" class="buton numar" value="8">8</button>
      <button id="9" class="buton numar" value="9">9</button>
      <button id="inmultit" class="buton operator" value="inmultit">*</button>
      <button id="0" class="buton numar" value="0">0</button>
      <button id="impartit" class="buton operator" value="impartit">/</button>
      <button id="executa" class="buton dublu">=</button>


                .carcasa {
  width: 300px;
  height: 350px;
  background: gray;
  margin: 20px auto 20px auto;

.ecran {
  width: 298px;
  height: 48px;
  background: white;
  border: 1px solid black;

.butoane {
  width: 298px;
  height: 298px;
  border: none;

.buton {
  background: blue;
  width: 74.25px;
  height: 74.25px;
  float: left;
  border: 1px solid gray;
  padding: 30px;
  font-size: 20px;
  color: #fff;
  box-sizing: border-box;

.numar {
  background: #4b5566;

.operator {
  background: #206638;

.dublu {
  width: 148.5px;
  padding-left: 70px;
  background-color: #ff8600;

.nr {
  width: 37.5%;
  margin: 0;
  padding: 0;
  float: left;
  height: 48px;
  box-sizing: border-box;
  text-align: center;
  font-size: 20px;

.op {
  width: 25%;
  margin: 0;
  box-sizing: border-box;
  height: 48px;
  text-align: center;
  font-size: 20px;


                var alcateleapas = 1;

var b1 = document.getElementById("1");
var b2 = document.getElementById("2");
var b3 = document.getElementById("3");
var b4 = document.getElementById("4");
var b5 = document.getElementById("5");
var b6 = document.getElementById("6");
var b7 = document.getElementById("7");
var b8 = document.getElementById("8");
var b9 = document.getElementById("9");
var b0 = document.getElementById("0");

var plus = document.getElementById("plus");
var minus = document.getElementById("minus");
var inmultit = document.getElementById("inmultit");
var impartit = document.getElementById("impartit");

function formeazaoperatia() {
  if(alcateleapas == 1) {
    document.getElementById("nr1").value = document.getElementById("nr1").value + "" + this.value
  } else {
    document.getElementById("nr2").value = document.getElementById("nr2").value + "" + this.value

function adaugaoperator() {
  alcateleapas = 2;
  else if (this.value=="minus")
  else if (this.value=="impartit")

b1.addEventListener("click", formeazaoperatia);
b2.addEventListener("click", formeazaoperatia);
b3.addEventListener("click", formeazaoperatia);
b4.addEventListener("click", formeazaoperatia);
b5.addEventListener("click", formeazaoperatia);
b6.addEventListener("click", formeazaoperatia);
b7.addEventListener("click", formeazaoperatia);
b8.addEventListener("click", formeazaoperatia);
b9.addEventListener("click", formeazaoperatia);
b0.addEventListener("click", formeazaoperatia);
plus.addEventListener("click", adaugaoperator);
minus.addEventListener("click", adaugaoperator);
inmultit.addEventListener("click", adaugaoperator);
impartit.addEventListener("click", adaugaoperator);

function executa() {
  alcateleapas = 1;
  var valoareadinstanga = document.getElementById("nr1").value;
  var valoareadindreapta = document.getElementById("nr2").value;
  var operator = document.getElementById("op").value;

  if(operator == "+") {
    alert(parseInt(valoareadinstanga) + parseInt(valoareadindreapta))
  else if(operator == "-") {
    alert(parseInt(valoareadinstanga) - parseInt(valoareadindreapta))
  else if(operator == "/") {
    alert(parseInt(valoareadinstanga) / parseInt(valoareadindreapta))
  else if(operator == "*") {
    alert(parseInt(valoareadinstanga) * parseInt(valoareadindreapta))
  document.getElementById("nr1").value = "";
  document.getElementById("nr2").value = "";
  document.getElementById("op").value = "";

document.getElementById("executa").addEventListener("click", executa);