toribio

toribio

Dec 11th, 2008
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.51 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Toribio's Background Color Test</title>
  4.         <script language='javascript' type='text/javascript'>
  5.             function markans(pergunta, presposta)
  6.             {
  7.                 if(pergunta == 1)window.resposta1 = presposta;
  8.                 if(pergunta == 2)window.resposta2 = presposta;
  9.                 if(pergunta == 3)window.resposta3 = presposta;
  10.                 if(pergunta == 4)window.resposta4 = presposta;
  11.             }
  12.             function calcular()
  13.             {
  14.                 var string = 'Voce ';
  15.                 string += (window.resposta1 == 2) ? 'acertou' : 'errou';
  16.                 string += ' a primeira pergunta, ';
  17.                 string += (window.resposta2 == 2) ? 'acertou' : 'errou';
  18.                 string += ' a segunda pergunta, ';
  19.                 string += (window.resposta3 == 2) ? 'acertou' : 'errou';
  20.                 string += ' a terceira pergunta e ';
  21.                 string += (window.resposta4 == 2) ? 'acertou' : 'errou';
  22.                 string += ' a quarta pergunta.';
  23.                 alert(string);
  24.             }
  25.         </script>
  26.     </head>
  27.     <body>
  28.         <li>Pergunta 1<br /></li>
  29.         <input type="radio" name="radio11" id="resp11" value="resp11" onfocus="markans(1, 1);" />Resposta 1<br />
  30.         <input type="radio" name="radio12" id="resp12" value="resp12" onfocus="markans(1, 2);" />Resposta 2<br />
  31.         <input type="radio" name="radio13" id="resp13" value="resp13" onfocus="markans(1, 3);" />Resposta 3<br />
  32.         <br />
  33.         <li>Pergunta 2<br /></li>
  34.         <input type="radio" name="radio21" id="resp21" value="resp21" onfocus="markans(2, 1);" />Resposta 1<br />
  35.         <input type="radio" name="radio22" id="resp22" value="resp22" onfocus="markans(2, 2);" />Resposta 2<br />
  36.         <input type="radio" name="radio23" id="resp23" value="resp23" onfocus="markans(2, 3);" />Resposta 3<br />
  37.         <br />
  38.         <li>Pergunta 3<br /></li>
  39.         <input type="radio" name="radio31" id="resp31" value="resp31" onfocus="markans(3, 1);" />Resposta 1<br />
  40.         <input type="radio" name="radio32" id="resp32" value="resp32" onfocus="markans(3, 2);" />Resposta 2<br />
  41.         <input type="radio" name="radio33" id="resp33" value="resp33" onfocus="markans(3, 3);" />Resposta 3<br />
  42.         <br />
  43.         <li>Pergunta 4<br /></li>
  44.         <input type="radio" name="radio41" id="resp41" value="resp41" onfocus="markans(4, 1);" />Resposta 1<br />
  45.         <input type="radio" name="radio42" id="resp42" value="resp42" onfocus="markans(4, 2);" />Resposta 2<br />
  46.         <input type="radio" name="radio43" id="resp43" value="resp43" onfocus="markans(4, 3);" />Resposta 3<br />
  47.         <br />
  48.         <span onclick="calcular();" style="cursor:default">Calcular</span>
  49.     </body>
  50. </html>
Add Comment
Please, Sign In to add comment