分類  >  Web前端 >

java裡邊特效精華代碼發掘1

tags:    時間:2013-12-10 20:06:55
java裡面特效精華代碼發掘1
 <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <TITLE>Blink image</TITLE> </HEAD> <BODY ONLOAD="soccerOnload()" topmargin="0"> <DIV ID="soccer" STYLE="position:absolute; left:150; top:0"> <a href="http://圖片的鏈接.com" target="_blank"> <IMG SRC="1.jpg" border="0"></a> </DIV> <SCRIPT LANGUAGE="JavaScript"> var msecs = 1000; //改變時間得到不同的閃爍間隔; var counter = 0;  function soccerOnload() { setTimeout("blink()", msecs); } function blink() { soccer.style.visibility = (soccer.style.visibility == "hidden") ? "visible" : "hidden"; counter +=1; setTimeout("blink()", msecs); } </SCRIPT> </BODY> </HTML> 



在這個讓圖片閃爍的代碼裡面精華所在是:
 soccer.style.visibility = (soccer.style.visibility == "hidden") ? "visible" : "hidden"; 

它,對於重複循環的操作進行判斷,這樣做不得不說是一件非常巧妙的做法······分享一下···

推薦閱讀文章

Bookmark the permalink ,來源:互聯網