<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h1>Hello, world!</h1>
<div class="col-md-4">
<div>
<div class="form-group">
<label for="campoNome">Nome:</label>
<input type="text" class="form-control" id="campoNome">
</div>
<div class="form-group">
<label for="campoIdade">Idade:</label>
<input type="number" class="form-control" id="campoIdade">
</div>
<button class="btn btn-lg btn-primary btn-block" id="botao">Adicionar</button>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="http://www.gstatic.com/firebasejs/3.9.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyAaSrIKEsL-wrT00C3EAlbOYttFCHkP8dI",
authDomain: "aula17deabril.firebaseapp.com",
databaseURL: "https://aula17deabril.firebaseio.com",
projectId: "aula17deabril",
storageBucket: "aula17deabril.appspot.com",
messagingSenderId: "113269429696"
};
firebase.initializeApp(config);
var nome = document.getElementById('campoNome');
var idade = document.getElementById('campoIdade');
var botao = document.getElementById('botao');
botao.addEventListener("click", function () {
var dados = {
nome : nome.value,
idade : idade.value
}
firebase.database().ref("tabela").push(dados);
});
</script>
</body>
</html>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.