translate.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. function change()
  2. {
  3. var parent = document.getElementById('parent');
  4. var children = parent.childNodes;
  5. console.log(children);
  6. if(children[1].style.display=="block"){
  7. document.getElementById('eng').style.display = "none";
  8. document.getElementById('esp').style.display = "block";
  9. var x = document.getElementsByClassName('esp');
  10. var i;
  11. for(i = 0; i<x.length; i++){
  12. x[i].style.display = "block";
  13. }
  14. var x = document.getElementsByClassName('eng');
  15. for(i = 0; i<x.length; i++){
  16. x[i].style.display = "none";
  17. }
  18. }
  19. else if(children[1].style.display=="none"){
  20. document.getElementById('eng').style.display = "block";
  21. document.getElementById('esp').style.display = "none";
  22. var x = document.getElementsByClassName('esp');
  23. var i;
  24. for(i = 0; i<x.length; i++){
  25. x[i].style.display = "none";
  26. }
  27. var x = document.getElementsByClassName('eng');
  28. for(i = 0; i<x.length; i++){
  29. x[i].style.display = "block";
  30. }
  31. }
  32. }