问题
I have a div which changes colors on multiple onclick events.
var linkClick = 1;
function update_link(obj){
if (linkClick == 1){obj.style.border = 'solid 1px red'};
if (linkClick == 2){obj.style.border = 'solid 1px blue'};
if (linkClick == 3){obj.style.border = 'solid 1px green'};
if (linkClick >3 ) {obj.style.border = 'solid 1px #555555'; linkClick=0};
linkClick++;
}
and in html: onclick="update_link(this);"
I need onmouseenter and onmouseleave to be disabled when I click the 1st time, and to be re-enabled again when I click the 3rd time.
I've tried to put this.onmouseleave='null'
in onclick
but I don't know how to re-enable it with another click or event.
Does somebody knows how to achieve this?
来源:https://stackoverflow.com/questions/18044757/disable-mouse-event-on-1st-and-re-enable-the-same-on-3rd-click-javascript