The implementation code of the js button flashing function is divided into two parts: html and js code. Please refer to this article for the specific implementation code
html
# #
<body onload="blinklink()" onunload="stoptimer()"> <a href="javascript:;" rel="external nofollow" class="iforeginbtn" id="flashit">马上注册领取</a> </p>
js
var flashit=document.getElementById('flashit'); function blinklink(){ if(flashit.style.backgroundColor=='rgb(232, 83, 63)'){ //注意:这里拿到的是rgb格式的 flashit.style.backgroundColor='#485fbd'; }else{ flashit.style.backgroundColor='rgb(232, 83, 63)'; } timer=setTimeout("blinklink()",300); } function stoptimer(){ clearTimeout(timer); }
The above is the detailed content of How is the JS button flashing function implemented?. For more information, please follow other related articles on the PHP Chinese website!