Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sig12(){
- var array = new Array(" Disponible ", " Ocupado ", " Mantenimiento ",);
- for(i=0; i < array.length; i++){
- if(document.getElementById('este12').value == array[i]){
- var indice = (i + 1 == array.length) ? 0 : i + 1;
- document.getElementById('este12').value = array[indice];
- localStorage.setItem("estado12", array[indice]);
- break;
- }
- }
- }
- window.onload=function()
- {
- if(localStorage.getItem("estado")!=null)
- {
- estado12 =localStorage.getItem("estado12");
- document.getElementById('este12').value = estado12;
- }
- }
- <div class="span2">
- <div class="well well-small">
- <h4 >Habitación 12</h4>
- <input id="este12" type="button" value=" Disponible " onclick="sig12()" />
- <br>
- <a href="habitacion1.php"><small>Alquilar</small></a>
- </div>
- </div>
- <div id='container'></div>
- <center><input id="crear1" type="button" value=" Añadir habitación "
- onclick="crear()" /></center>
- var i = 0;
- function crear() {
- var array = new Array(" Disponible ", " Ocupado ", " Mantenimiento ");
- if (i + 1 < array.length) {
- i++;
- crearDivs(array[i], array);
- } else {
- i = 0;
- crearDivs(array[i], array);
- }
- }
- function crearDivs(nameDiv, array) {
- let divNuevo = document.createElement('div');
- divNuevo.classList.add('divs');
- divNuevo.innerHTML = nameDiv;
- document.getElementById('container').appendChild(divNuevo);
- document.getElementById('crear1').value = array[i];
- }
- .divs {
- float: left;
- width: 140px;
- height: 110px;
- background: white;
- margin-left: 20px;
- color: black;
- }
Add Comment
Please, Sign In to add comment