JS按钮闪烁功能的实现代码
时间:2021-03-18 09:44:59|栏目:JavaScript代码|点击: 次
html
<body onload="blinklink()" onunload="stoptimer()"> <a href="javascript:;" rel="external nofollow" class="iforeginbtn" id="flashit">马上注册领取</a> </div>
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);
}
总结
栏 目:JavaScript代码
下一篇:详解vue-cli+es6引入es5写的js(两种方法)
本文标题:JS按钮闪烁功能的实现代码
本文地址:http://www.codeinn.net/misctech/83014.html






