<input type="button" id="A" value="0" onClick="this.value= ((this.value==0) ? 1: 0); faz_xor(); " style="float: left" /> <input type="button" id="B" value="0" onClick="this.value= ((this.value==0) ? 1: 0); faz_xor(); " /> <img src="http://www.emararaquara.com.br/ingles/javascript/xor.png" /> <b id="S">0</b> <script language="JavaScript"> var A= document.getElementById ("A"); var B= document.getElementById ("B"); var S= document.getElementById ("S"); function faz_xor () { S.innerHTML= A.value^ B.value; } </script>Salve o arquivo como porta-xor.html, por exemplo.
Abra-o com um navegador de Internet. Você vai obter uma tela como esta:
Clique nos botões à esquerda para testar.
Nota: Este programa poderá não funcionar no MSIE.
Nenhum comentário:
Postar um comentário