Skip to content

Instantly share code, notes, and snippets.

@Gonzalo2683
Last active August 29, 2015 14:17
Show Gist options
  • Save Gonzalo2683/4030a1c4eb0444434e72 to your computer and use it in GitHub Desktop.
Save Gonzalo2683/4030a1c4eb0444434e72 to your computer and use it in GitHub Desktop.
Receta onready, clase Lunes 23 de marzo, se usó jQuery, se creó un patrón sencillo de inicio de funciones en la carga del documento.
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="js/codigo.js" type="text/javascript"></script>
</head>
<body>
<div>TODO write content</div>
<input id="botoncito" type="button" value="saludo" />
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Prático</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form>
<label for="txtNombre">Nombre:</label>
<input type="text" id="txtNombre" /> <br />
<label for="txtApellido">Apellido:</label>
<input type="text" id="txtApellido"/> <br />
<input type="button" value="Mostrar formateado" id="btnMuestraFormateo" />
<hr />
<label for="txtValor1">valor1:</label>
<input type="text" id="txtValor1" /> <br/>
<label for="txtValor2">valor2:</label>
<input type="text" id="txtValor2" /> <br/>
<input id="btnCalcularSuma" type="button" value="Calcular suma" /> <br/>
<p>resultado</p>
<hr />
<label for="txtCantidad">Valor(cantidad):</label>
<input type="text" id="txtCantidad" /> <br/>
<label for="txtCambio">Cambio:</label>
<input type="text" id="txtCambio" /> <br/>
<input id="btnConversion" type="button" value="Conversión" /> <br/>
<p>aqui se mostrará la conversión</p>
<hr />
<label for="txtHarina">Gramos de harina:</label>
<input type="text" id="txtHarina" /> <br/>
<label for="txtAceite">cucharadas de aceite:</label>
<input type="text" id="txtAceite" /> <br/>
<label for="txtAgua">Tazas de agua:</label>
<input type="text" id="txtAgua" /> <br/>
<input id="btnCalcularRecetas" type="button" value="Calcular recetas" /> <br/>
<p>aqui se mostrará la receta</p>
<hr />
<table>
<tr>
<td><img src="Beatles_27399_236.jpg" /></td>
<td><img src="Beatles_27399_236.jpg" /></td>
<td><img src="Beatles_27399_236.jpg" /></td>
</tr>
<tr>
<td>Celda 2</td>
<td>Celda 1</td>
<td>Celda 1</td>
</tr>
<tr>
<td>Celda 2</td>
<td>Celda 1</td>
<td>Celda 1</td>
</tr>
</table>
</form>
</body>
</html>
/*
* Receta de onready
*/
$(document).ready(inicio); //Cuando el documento cargue completamente se ejecuta la función inicio()
function inicio(){
document.getElementById("botoncito").onclick = saludo; // Se vincula el id con la función saludo
}
function saludo() {// función saludo en sí
alert('Hola mundo...');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment