Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTML - >
- Esqueleto:
- ''''''''''''''''''''''''''''''''''''''''
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8"/>
- <title>Titulo</title>
- </head>
- <body>
- </body>
- </html>
- '''''''''''''''''''''''''''''''''''''''''''''
- Tags Basicas:
- Formularios:
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''
- action:
- <form action=""> se for vazia é a propria pagina
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- method:
- <form method=""> vazio = get [pela url]
- '''''''''''''''''''''''''''''''''''''''''''''''''''''
- input:
- <form action="">
- First name: <input type="text" name="fname"><br>
- Last name: <input type="text" name="lname"><br>
- <input type="submit" value="Submit">
- </form>
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- select:
- <select>
- <option value="volvo">Volvo</option>
- <option value="saab">Saab</option>
- <option value="mercedes">Mercedes</option>
- <option value="audi">Audi</option>
- </select>
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- button:
- <button type="button">Click Me!</button>
- Resto dos atributos --> http://www.w3schools.com/tags/tag_button.asp
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- radio + label:
- <form action="demo_form.asp">
- <label for="male">Male</label>
- <input type="radio" name="sex" id="male" value="male"><br>
- <label for="female">Female</label>
- <input type="radio" name="sex" id="female" value="female"><br>
- <input type="submit" value="Submit">
- </form>
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- CSS-> http://www.w3schools.com/css/css_examples.asp
- body {
- background-color: #d0e4fe;
- }
- h1 {
- color: orange;
- text-align: center;
- }
- p {
- font-family: "Times New Roman";
- font-size: 20px;
- }
- Seletores:
- Tag <tag>
- classes .Classe
- id #id
- color, font-family, background-color
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- JS->
- mathRandom(); :
- Math.floor((Math.random() * 10) + 1); // retorna numero entre 1 e 10
- Math.floor((Math.random() * 100) + 1); // retorna numero entre 1 e 100
- tag <script></script>
- eventos:
- ~~onclick:
- <button onclick="myFunction()">Click me</button>
- ~~onsubmit:
- <form onsubmit="myFunction()">
- Enter name: <input type="text">
- <input type="submit">
- </form>
- ~~vetores:
- var v = [1,2,3];
- ~~push:
- v.push(6); adiciona o 6
- ~~indexOf:
- var index = v.indexOf(2); Encontra o index do '2' // se n existe retorna -1
- ~~splice:
- v.splice(index,1); // apaga o numero do index // se o index retornar -1 apaga o ultimo
- ''''''''''''''''''''''''''''''''''''''''''''''''''
- foreach:
- function insereNaLista(x){
- var lista = document.getElementById('lista');
- var li = document.createElement('li');
- li.innerHTML = x;
- lista.appendChild(li);
- }
- var numeros = [10, 20, 30];
- numeros.forEach(insereNaLista);
- var numeros2 = numeros.map(function(x){
- return x * x;
- }
- iteração:
- ~~~~~~~~~~~~~~~~~~DOM>
- ''''''''''''''''''''''''''''''''''''''''''''''''''
- ~~getElementBydID:
- var titulo = document.getElementById("id")
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ~~getElementsByTagName
- var titulo = getElementsByTagName('h1');
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ~~createEelement:
- var strong = document.createElement('strong');
- strong.appendChild(document.createTextNode('Teste');
- bloco.appendChild(strong);
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- CreateTextNode
- manipulação da arvore
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ~~inner HTML:
- var bloco = document.getElementById('bloco1');
- bloco.innerHTML = '<ul><li> Teste </li></ul>'
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ~~setTimeout:
- var myVar;
- function myFunction() {
- myVar = setTimeout(alertFunc, 3000);
- }
- function alertFunc() {
- alert("Hello!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement