cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="boxticket">
    <p id="titleBillete">Viagens Javascript</p>
    <div class="pedidoBox">
       <input class="test"
              type="text"
              id="origem"
              onkeyup="leerDatos(event)"
              placeholder="Origem"
              value="">
    </div>
    <div class="pedidoBox">
       <input class="test"
              type="text"
              id="destino"
              placeholder="Destino"
              value="">
    </div> 
    <div class="pedidoBox">
        <span>Hora</span>
        <select name="hora" id="hora">
            <option value="1">08:00</option>
            <option value="2">10:00</option>
            <option value="3">12:00</option>
            <option value="4">14:00</option>
            <option value="5">18:00</option>
            <option value="6">20:00</option>
        </select>
	    </div>    		    
      <div class="pedidoBox">
          <span>Cantidad</span>
          <select name="cuant" id="cuant">
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>
              <option value="4">4</option>
              <option value="5">5</option>
              <option value="6">6</option>
          </select>
      </div>

      <div class="pedidoBox">
          <span>Sexo</span>
          <select name="sexo" id="sexo">
              <option value="1">Masculino</option>
              <option value="2">Femenino</option>
          </select>
      </div>

      <div class="boxColor">
        <span>Color</span>
        <input value="#95eab7"
               type="color"
               name="color"
               class="color">
      </div>

      <input type="submit"
             id="enviarTJ"
             value="ok">
			    
</div>

<div id="containerVL"></div>
<span class="mysite">Junio Marques | front-end developer Ecommerce - my site: <a  href="http://juniomarques.com" target="black">juniomarques.com</a></span>
            
          
!
            
              @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Lobster|Montserrat:400,700);
body, html {
  font-family: arial;
  margin: 0;
}
canvas {
  background: #fff;
  position: relative;
  left: 0;
  width: 100%;
  height: auto;
  z-index: -1;
} 
#boxticket {
    max-width: 300px;
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px;
    box-shadow: 0 0 10px #747171;
    background: #fff;
    position: absolute;
    top: 0;
    left: 0;
}
#containerVL {
    @extend #boxticket; 
    border: none;
    box-shadow: none;
    padding: 0;
    width: 100%;
    left: 340px;
}
.animMove { animation: mover .01s ease 50; }
.destacar { border:1px solid red; }
.msn      { font-size:18px; }
@keyframes mover {
  0%   { transform: rotate(1deg);  }
  100% { transform: rotate(-1deg); }
}
.memo {
  background: yellow;
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  text-align: center;
  transform: rotate(60deg);
}
.pedidoBox {
    display: inline-block;
    width:48%;
    margin: 0 0 20px 0;
    span { display: block; }
}
input[type="text"] { width: 98%; }
.fecha {
    border-bottom: 1px solid #ccc;
    font-size:10px;
    text-transform: uppercase;
    font-weight: bold;
}
select { width: 60%; }
.cerrarBL {
    text-decoration: none;
    color: #555555;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    background: #ccc;
    width: 15px;
    border-radius: 50%;
    height: 15px;
    text-align: center;
}
.info {
    font-size: 11px;
    border-bottom: 1px solid;
    width: 90%;
    padding: 0 0 5px;
    margin-bottom: 40px;
}
.tarjeta {
   border: 1px solid #ccc; 
   padding: 10px;
   margin: 15px 0;
}
#enviarTJ {
  width: 116px;
  background: #72E0D6;
  font-size:12px;
  border: 0;
  color: #595959;
  padding: 6px;
  text-transform: uppercase;
  color: #fff;
  display: block;
  &:hover { background: darken(#72E0D6, 10%); }
}
.box {
   border: 1px dashed #646464; 
   padding: 10px;
   margin: 15px 0;
   position:relative;
}
#titleBillete {
    font: 500 35px Lobster;
    margin: 10px 0 20px;
    color: rgb(42, 59, 60);
}
.hora { float:left; }
.cant { float: right; }
.colorTest { background:red; }
.boxColor {
  display:inline-block;
    .color {
      width: 30px;
      height: 30px;
      border: none;
      padding: 0;
      background: #fff;
  }
}
.mysite {
	display:block;
	text-align:right;
	text-align:center;
	display:block;
}
.clearfix:before,
.clearfix:after {
  content: " ";
  display: table;
}
.clearfix:after {
  clear: both;
}

            
          
!
            
              
var campos = document.querySelectorAll("#boxticket .test");

var leerDatos = function() {

    var boxticket = document.getElementById("boxticket"),
        aviso     = document.getElementById("titleBillete"),
        origemV   = campos[0].value,
        destinoV  = campos[1].value,
        colorV    = $('input[name=color]').val(),
        meses, dias, xData, fecha;

    meses = [
      "Enero",
      "Febrero",
      "Marzo",
      "Abril",
      "Mayo",
      "Junio",
      "Julio",
      "Agosto",
      "Septiembre",
      "Octubre",
      "Noviembre",
      "Diciembre"
    ];
    dias = [
      "Domingo",
      "Lunes",
      "Martes",
      "Miércoles",
      "Jueves",
      "Viernes",
      "Sábado"
    ];
    xData = new Date();
    fecha = (
      dias[xData.getDay()] + ", " +
      xData.getDate() + " de " +
      meses[xData.getMonth()] + " de " +
      xData.getFullYear() + " , " +
      xData.getHours() + ":" + xData.getMinutes()
    );

    if(origemV === "" || destinoV === "") {
        boxticket.className = "animMove";
        for (var i = 0; i < campos.length; i++) {
          campos[i].className = "destacar";
        }
        aviso.innerHTML = "<p class='msn'>Ops,\
                            <span class='memo'>:(</span>Los campos origem y destino son obligatorios.\
                          </p>";
    } else {
        aviso.innerHTML = "<p id='titleBillete'>Viagens Javascript</p>";
        boxticket.className = "";

        for (var i = 0; i < campos.length; i++) {
          campos[i].className = "";
        }

        var fechaTotal = origemV + " " + fecha,
            hora       = document.getElementById("hora")
                        .options[document.getElementById("hora").selectedIndex].text,
            cantidad   = document.getElementById("cuant")
                        .options[document.getElementById("cuant").selectedIndex].value,
            sexo       = document.getElementById("sexo")
                        .options[document.getElementById("sexo").selectedIndex].text,
            boxId      = Math.floor(Math.random() * 1000);

        imprimirBillete(
          fechaTotal,
          origemV,
          destinoV,
          hora,
          cantidad,
          sexo,
          colorV
        );
    }
};

(function eventos() {
    var enviar = document.getElementById("enviarTJ");
        enviar.addEventListener("click", leerDatos);
    
    for(var i = 0; i < campos.length; i++) {
        campos[i].onmouseover = function(e) {
          this.value = "";
        }
    }
})();

function imprimirBillete(
                          fechaTotal,
                          origemV,
                          destinoV,
                          hora,
                          cantidad,
                          sexo,
                          colorV
                        ) {
    var container = document.getElementById("containerVL");
    container.innerHTML += '<div class="box" style="background:' + colorV + '">\
                              <a class="cerrarBL" data-clic="close" href="JavaScript:void(0)">x</a>\
                              <p class="fecha">' + fechaTotal + '</p>\
                              <p>Origem: ' + origemV + '</p>\
                              <p>Destino: ' + destinoV + '</p>\
                              <div class="clearfix">\
                                <span class="hora">Hora: ' + hora + '</span>\
                                <span class="cant">Cantidad: ' + cantidad + '</span>\
                              </div>\
                              <p>Sexo: ' + sexo + '</p>\
                            </div>';

  var box      = document.querySelectorAll('.box'),
      boxArray = Array.prototype.slice.call(box, 0);

  boxArray.forEach(function(x) {
    var close = x.querySelector('a[data-clic="close"]');
        close.onclick = function(e) {
          close.parentNode.remove();
        }
  });
}







            
          
!
999px
Loading ..................

Console