var count = 0;
var change_mode_btn = document.getElementsByClassName("change_translate");
var trs_source = document.getElementsByClassName("yll-trs-source");
var trs_target = document.getElementsByClassName("yll-trs-target");

change_mode_btn[0].addEventListener("click", myFunction);

function myFunction() {
	count = (count + 1)%3
  console.log(count)
  if (count == 0){
  	for (var i = 0, len = trs_source.length; i < len; i++){
    trs_source[i].setAttribute("style","display:none;") ;} 
    for (var i = 0, len = trs_target.length; i < len; i++){
    trs_target[i].setAttribute("style","display:block;") ;} 
  }else if (count == 1){
  	for (var i = 0, len = trs_source.length; i < len; i++){
    trs_source[i].setAttribute("style","display:block;") ;} 
    for (var i = 0, len = trs_target.length; i < len; i++){
    trs_target[i].setAttribute("style","display:none;") ;} 
  }else{
  	for (var i = 0, len = trs_source.length; i < len; i++){
    trs_source[i].setAttribute("style","display:block;") ;} 
    for (var i = 0, len = trs_target.length; i < len; i++){
    trs_target[i].setAttribute("style","display:block;") ;} 
  }
}

 

您的电子邮箱地址不会被公开。 必填项已用*标注