为了账号安全,请及时绑定邮箱和手机立即绑定

JS报错Unexpected end of input

JS报错Unexpected end of input

maturity_process 2018-05-22 17:23:17
JS代码:var city = document.getElementsByClassName("city-name");var city_ico = document.getElementsByClassName("ico-city");var city_list = document.getElementsByClassName("city-list")//ico翻转function ico_rotate(){    var classVal = city_ico[0].getAttribute("class");    var city_hover = document.getElementsByClassName("city-hover");    //判断city是否存在    if(city_hover.length !== 0){        classVal = classVal.replace(" city-hover"," ");        city_ico[0].setAttribute("class",classVal);    }else{        classVal = classVal.concat(" city-hover");        city_ico[0].setAttribute("class",classVal);    }};//显示隐藏function toggle(className,num){    var list = className[num].style.display;    if(list == "block"){        className[num].style.display = "none";    }else{        className[num].style.display = "block";    }city[0].addEventListener("mouseover",ico_rotate);city[0].addEventListener("mouseout",ico_rotate);city[0].addEventListener("mouseover",function(){    toggle(city_list,0);});city[0].addEventListener("mouseout",function(){    toggle(city_list,0);});
查看完整描述

1 回答

?
maturity_process

TA贡献5条经验 获得超5个赞

city[0].addEventListener("mouseover",ico_rotate);前没有大括号

查看完整回答
反对 回复 2018-05-22
  • 1 回答
  • 0 关注
  • 14761 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信