whiplk

[CODE] - Tradutor(simples.js)

May 20th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //textarea translate...
  2. //Segue a lógica, adicionando mais palavras e suas traduções.
  3.  
  4. <html>
  5. <script type="text/javascript" >
  6. function translate()
  7. {
  8. var word = '\0';
  9. var sii = document.getElementById("trans").value;
  10. if ( sii == "eu" )
  11. {
  12. word = "me";
  13. }
  14. else if ( sii == "você" )
  15. {
  16. word = "you";
  17. }
  18. else if ( sii == "traduzir" )
  19. {
  20. word = "translate";
  21. }
  22. else if ( sii == "nome" )
  23. {
  24. word = "name";
  25. }
  26. else if ( sii == "vida" )
  27. {
  28. word = "life";
  29. }
  30. else if ( !sii )
  31. {
  32. word = "Não foi digitado nada no textbox de tradução..";
  33. }
  34. alert(word);
  35. }
  36. </script>
  37. <textarea id="trans" cols="15" rows="4" ></textarea><br>
  38. <input type="button" value="traduzir" onclick="translate()" />
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment