TADS:Estrutura de Dados: codigos0202
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script><script>
$(document).ready(function(){
$("#botao").click(function(){
var cor = $("input[name='cor']:checked").val();
var op = $("#operacao").val();
var n1 = new Number($("#num1").val()); var n2 = new Number($("#num2").val());
if(op == "som") $("#saida").html(n1+n2); else if (op == "sub") $("#saida").html(n1-n2); else if (op == "mult") $("#saida").html(n1*n2);
$("#saida").css("color", cor );
var saida = $("#saida").html();
$("input[name='linguagem']:checked").each(function(){ saida = saida + $(this).val()+ " "; }); $("#saida").html(saida); $("#num1").val(""); $("#num2").val(""); //var antes = $("#saida").html();
//$("#saida").html(antes + "
Ola
");
});
}); </script> <head></head> <body> <select id="operacao"> <option value="som">Somar</option> <option value="sub">Subtrair</option> <option value="mult">Multiplicar</option> </select> <input type="text" id="num1">
<input type="text" id="num2">
<input type="radio" name="cor" value="blue"><label for="cor">Azul</label>
<input type="radio" name="cor" value="red"><label for="cor">Vermelho</label>
<input type="checkbox" name="linguagem" value="C"> C
<input type="checkbox" name="linguagem" value="C++"> C++
<input type="checkbox" name="linguagem" value="Java"> Java
<input type="checkbox" name="linguagem" value="jQuery"> jQuery
<input type="button" value="Somar" id="botao">
</body> </html>