My code is the following and works perfectly, besides that there is more div, but I want to add a button that is called "Add new room" and when I press it I want to create another one in the body similar to the code What is present Is it possible to do that? If so, more or less how could I elaborate it?
<script type="text/javascript">
function sig(){
var array = new Array(" Disponible ", " Ocupado ", " Mantenimiento ",);
for (i = 0; i < array.length; i++) {
if(document.getElementById('Fmbtn').value == array[i]) {
var indice = (i + 1 == array.length) ? 0 : i + 1;
document.getElementById('Fmbtn').value = array[indice];
localStorage.setItem("estado", array[indice]);
break;
}
}
}
window.onload=function()
{
if(localStorage.getItem("estado") != null) {
estado =localStorage.getItem("estado");
document.getElementById('Fmbtn').value = estado;
}
}
HTML:
<div class="row" style="text-align:center">
<div class="span2">
<div class="well well-small">
<h4>Habitación 1</h4>
<input id="Fmbtn" type="button" value=" Disponible " onclick="sig()" />
<a href="habitacion1.php"><small>Ver detalles</small></a>
</div>
</div>