怎么实现html中的input状态,事件的绑定,获得焦点的优先级最高
获得焦点时:opacity=0.8,"\n"鼠标移动到元素上时:opacity=0.8,"\n"鼠标移出元素时:opacity=0.2,"\n"失去焦点时:opacity...
获得焦点时:opacity=0.8,"\n"鼠标移动到元素上时:opacity=0.8,"\n"鼠标移出元素时:opacity=0.2,"\n"失去焦点时:opacity=0.2,"\n"====================也就是说获得焦点的优先级最高,失焦后再考虑其他事件,我的代码有问题.===============window.onload = function () { var input_search = document.getElementById("search1"); input_search.addEventListener("mouseover", function (e) { input_search.style.opacity = 0.8 }) input_search.addEventListener("focus", function (e) { input_search.style.opacity = 0.8 }) input_search.addEventListener("blur", function () { input_search.style.opacity = 0.2 }) input_search.addEventListener("mouseout", function () { input_search.style.opacity = 0.2 }) }
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询