Advertisement
GreMendes

Resumo para prova de Tecnologia de Prog

Sep 29th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.95 KB | None | 0 0
  1. HTML - >
  2. Esqueleto:
  3. ''''''''''''''''''''''''''''''''''''''''
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8"/>
  8. <title>Titulo</title>
  9. </head>
  10. <body>
  11.  
  12. </body>
  13. </html>
  14. '''''''''''''''''''''''''''''''''''''''''''''
  15. Tags Basicas:
  16.  
  17. Formularios:
  18. '''''''''''''''''''''''''''''''''''''''''''''''''''''''
  19. action:
  20. <form action=""> se for vazia é a propria pagina
  21. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  22. method:
  23. <form method=""> vazio = get [pela url]
  24. '''''''''''''''''''''''''''''''''''''''''''''''''''''
  25. input:
  26. <form action="">
  27.   First name: <input type="text" name="fname"><br>
  28.   Last name: <input type="text" name="lname"><br>
  29.   <input type="submit" value="Submit">
  30. </form>
  31. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  32. select:
  33. <select>
  34.   <option value="volvo">Volvo</option>
  35.   <option value="saab">Saab</option>
  36.   <option value="mercedes">Mercedes</option>
  37.   <option value="audi">Audi</option>
  38. </select>
  39. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  40. button:
  41. <button type="button">Click Me!</button>
  42. Resto dos atributos --> http://www.w3schools.com/tags/tag_button.asp
  43. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  44. radio + label:
  45. <form action="demo_form.asp">
  46.   <label for="male">Male</label>
  47.   <input type="radio" name="sex" id="male" value="male"><br>
  48.   <label for="female">Female</label>
  49.   <input type="radio" name="sex" id="female" value="female"><br>
  50.   <input type="submit" value="Submit">
  51. </form>
  52. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  53.  
  54. CSS-> http://www.w3schools.com/css/css_examples.asp
  55.  
  56. body {
  57.     background-color: #d0e4fe;
  58. }
  59.  
  60. h1 {
  61.     color: orange;
  62.     text-align: center;
  63. }
  64.  
  65. p {
  66.     font-family: "Times New Roman";
  67.     font-size: 20px;
  68. }
  69.  
  70. Seletores:
  71. Tag <tag>
  72. classes .Classe
  73.  
  74. id #id
  75.  
  76. color, font-family, background-color
  77. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  78. JS->
  79. mathRandom(); :
  80. Math.floor((Math.random() * 10) + 1); // retorna numero entre 1 e 10
  81. Math.floor((Math.random() * 100) + 1); // retorna numero entre 1 e 100
  82.  
  83.  
  84.  
  85. tag <script></script>
  86.  
  87. eventos:
  88. ~~onclick:
  89. <button onclick="myFunction()">Click me</button>
  90.  
  91. ~~onsubmit:
  92.  
  93. <form onsubmit="myFunction()">
  94.   Enter name: <input type="text">
  95.   <input type="submit">
  96. </form>
  97.  
  98. ~~vetores:
  99. var v = [1,2,3];
  100.  
  101. ~~push:
  102. v.push(6);    adiciona o 6
  103.  
  104. ~~indexOf:
  105. var index = v.indexOf(2); Encontra o index do '2' // se n existe retorna -1
  106.  
  107. ~~splice:
  108. v.splice(index,1); // apaga o numero do index // se o index retornar -1 apaga o ultimo
  109.  
  110.  
  111.  
  112. ''''''''''''''''''''''''''''''''''''''''''''''''''
  113. foreach:
  114. function insereNaLista(x){
  115. var lista = document.getElementById('lista');
  116. var li = document.createElement('li');
  117. li.innerHTML = x;
  118. lista.appendChild(li);
  119. }
  120.  
  121. var numeros = [10, 20, 30];
  122. numeros.forEach(insereNaLista);
  123.  
  124. var numeros2 = numeros.map(function(x){
  125. return x * x;
  126. }
  127. iteração:
  128.  
  129. ~~~~~~~~~~~~~~~~~~DOM>
  130. ''''''''''''''''''''''''''''''''''''''''''''''''''
  131. ~~getElementBydID:
  132. var titulo = document.getElementById("id")
  133.  
  134. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  135. ~~getElementsByTagName
  136.  
  137. var titulo = getElementsByTagName('h1');
  138.  
  139.  
  140. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  141. ~~createEelement:
  142. var strong = document.createElement('strong');
  143. strong.appendChild(document.createTextNode('Teste');
  144. bloco.appendChild(strong);
  145.  
  146. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  147. CreateTextNode
  148. manipulação da arvore
  149.  
  150. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  151. ~~inner HTML:
  152. var bloco = document.getElementById('bloco1');
  153. bloco.innerHTML = '<ul><li> Teste </li></ul>'
  154. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  155. ~~setTimeout:
  156. var myVar;
  157.  
  158. function myFunction() {
  159.     myVar = setTimeout(alertFunc, 3000);
  160. }
  161.  
  162. function alertFunc() {
  163.     alert("Hello!");
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement