啦啦啦,代码分享,我们时常在别人网站看到人家图片很炫,但仔细观察却又不是通过gif或者Flash展现的,,今天在易梦看到了通过JS来实现图片炫起来的方法,以下是代码,是两种方法哦。
<img id="imgid" style="visibility:visible" src="http://darker.2014idc.com/content/templates/emedia/images/emedialogo.png" />
<script type="text/javascript">
function show(){
var imgid=document.getElementById("imgid");
if(imgid.style.visibility == "visible")
imgid.style.visibility = "hidden";
else
imgid.style.visibility = "visible";
setTimeout('show()',300);
}
show();
</script>
<br><br><br><br><br>
<DIV ID="soccer">
<img SRC="http://darker.2014idc.com/content/templates/emedia/images/emedialogo.png" border="0" style="cursor:pointer;"/>
</DIV>
<SCRIPT>
var msecs=100; //改变时间得到不同的闪烁间隔;
var counter=0;
function soccerOnload(){
setTimeout("blink()", msecs)}
function blink(){
soccer.style.visibility=
(soccer.style.visibility=="hidden") ? "visible" : "hidden"
counter+=1;setTimeout("blink()", msecs)}soccerOnload()
</SCRIPT>
本文章来自蔡先森博客!希望以上代码对您有用,谢谢。 THE-END BY:darker
|