Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Toribio's Background Color Test</title>
- <script language='javascript' type='text/javascript'>
- function markans(pergunta, presposta)
- {
- if(pergunta == 1)window.resposta1 = presposta;
- if(pergunta == 2)window.resposta2 = presposta;
- if(pergunta == 3)window.resposta3 = presposta;
- if(pergunta == 4)window.resposta4 = presposta;
- }
- function calcular()
- {
- var string = 'Voce ';
- string += (window.resposta1 == 2) ? 'acertou' : 'errou';
- string += ' a primeira pergunta, ';
- string += (window.resposta2 == 2) ? 'acertou' : 'errou';
- string += ' a segunda pergunta, ';
- string += (window.resposta3 == 2) ? 'acertou' : 'errou';
- string += ' a terceira pergunta e ';
- string += (window.resposta4 == 2) ? 'acertou' : 'errou';
- string += ' a quarta pergunta.';
- alert(string);
- }
- </script>
- </head>
- <body>
- <li>Pergunta 1<br /></li>
- <input type="radio" name="radio11" id="resp11" value="resp11" onfocus="markans(1, 1);" />Resposta 1<br />
- <input type="radio" name="radio12" id="resp12" value="resp12" onfocus="markans(1, 2);" />Resposta 2<br />
- <input type="radio" name="radio13" id="resp13" value="resp13" onfocus="markans(1, 3);" />Resposta 3<br />
- <br />
- <li>Pergunta 2<br /></li>
- <input type="radio" name="radio21" id="resp21" value="resp21" onfocus="markans(2, 1);" />Resposta 1<br />
- <input type="radio" name="radio22" id="resp22" value="resp22" onfocus="markans(2, 2);" />Resposta 2<br />
- <input type="radio" name="radio23" id="resp23" value="resp23" onfocus="markans(2, 3);" />Resposta 3<br />
- <br />
- <li>Pergunta 3<br /></li>
- <input type="radio" name="radio31" id="resp31" value="resp31" onfocus="markans(3, 1);" />Resposta 1<br />
- <input type="radio" name="radio32" id="resp32" value="resp32" onfocus="markans(3, 2);" />Resposta 2<br />
- <input type="radio" name="radio33" id="resp33" value="resp33" onfocus="markans(3, 3);" />Resposta 3<br />
- <br />
- <li>Pergunta 4<br /></li>
- <input type="radio" name="radio41" id="resp41" value="resp41" onfocus="markans(4, 1);" />Resposta 1<br />
- <input type="radio" name="radio42" id="resp42" value="resp42" onfocus="markans(4, 2);" />Resposta 2<br />
- <input type="radio" name="radio43" id="resp43" value="resp43" onfocus="markans(4, 3);" />Resposta 3<br />
- <br />
- <span onclick="calcular();" style="cursor:default">Calcular</span>
- </body>
- </html>
Add Comment
Please, Sign In to add comment