Image effects-code for flashing the image border

Source: Internet
Author: User
Tip: you can modify some code before running

Image effects-code for flashing the image border<script language="javascript">Var line = new Array (); var w = 35;<!-- 一条边框的小格的个数(所以是个正方形)-->Var left = 7;<!-- 这个是边框在页面中的位置的左上角的X坐标-->Var top = 12;<!-- 自然就是纵坐啦-->Var width = 4;<!-- 边框中一小格的象素宽-->Var height = 3;<!-- 边框的高度,设为1的话就是一条细线了-->Line [0] = "ff" + Number (25 ). toString (16) + Number (25 ). toString (16); line [1] = "ff" + Number (50 ). toString (16) + Number (50 ). toString (16); line [2] = "ff" + Number (75 ). toString (16) + Number (75 ). toString (16); line [3] = "ff" + Number (100 ). toString (16) + Number (100 ). toString (16); line [4] = "ff" + Number (125 ). toString (16) + Number (125 ). toString (16); line [5] = "ff" + Number (150 ). toString (16) + Number (150 ). toString (16); line [6] = "ff" + Number (175 ). toString (16) + Number (175 ). toString (16); line [7] = "ff" + Number (200 ). toString (16) + Number (200 ). toString (16); line [8] = "ff" + Number (225 ). toString (16) + Number (225 ). toString (16); line [9] = "ff" + Number (225 ). toString (16) + Number (225 ). toString (16); line [10] = "ff" + Number (225 ). toString (16) + Number (225 ). toString (16); line [11] = "ff" + Number (225 ). toString (16) + Number (225 ). toString (16); line [12] = "ff" + Number (200 ). toString (16) + Number (200 ). toString (16); line [13] = "ff" + Number (175 ). toString (16) + Number (175 ). toString (16); line [14] = "ff" + Number (150 ). toString (16) + Number (150 ). toString (16); line [15] = "ff" + Number (125 ). toString (16) + Number (125 ). toString (16); line [16] = "ff" + Number (100 ). toString (16) + Number (100 ). toString (16); line [17] = "ff" + Number (75 ). toString (16) + Number (75 ). toString (16); line [18] = "ff" + Number (50 ). toString (16) + Number (50 ). toString (16); line [19] = "ff" + Number (25 ). toString (16) + Number (25 ). toString (16); function writes (num) {var temp; var s; var tl, tt; var tw, th; temp = num + 1;<!--定义变量-->If (num = 0)<!--写第一条边-->{Tl = left;<!--左边界-->Tt = top;<!--上边界-->Tw = w * width;<!--宽度-->Th = height;<!--高度-->S ="<table +tl+"px; top: "+tt+"px; width: "+tw+"px; height: "+th+"px;' cellspacing='0' cellpadding='0' ><tr>"; for(r=0;r<w;r++)<!--依次画出每一个小格-->{Temp = r + w * num;<!--获得当前的小格的位置-->S + ="<td id=tab"+temp+" bgcolor=red></td>";<!--写入小格-->} S + ="</tr></table>";} If (num = 1)<!--写第二条边-->{Tl = left + w * width;<!--左边界-->Tt = top;<!--上边界-->Tw = height;<!--高度-->Th = w * width;<!--宽度-->S ="<table +tl+"px; top: "+tt+"px; width: "+tw+"px; height: "+th+"px;' cellspacing='0' cellpadding='0'>"; for(r=0;r<w;r++)<!--依次画出每一个小格-->{Temp = r + w * num;<!--获得当前的小格的位置-->S + ="<tr><td id=tab"+temp+" bgcolor=red></td></tr>";<!--写入小格-->} S + ="</table>";} If (num = 2)<!--写第三条边-->{Tl = left + height;<!--上边界-->Tt = top + w * width;<!--左边界-->Tw = w * width;<!--宽度-->Th = height;<!--高度-->S ="<table +tl+"px; top: "+tt+"px; width: "+tw+"px; height: "+th+"px;' cellspacing='0' cellpadding='0'><tr>"; for(r=w;r>0; r --)<!--依次画出每一个小格-->{Temp = r-1 + w * num; s + ="<td id=tab"+temp+" bgcolor=red></td>";<!--写入小格-->} S + ="</tr></table>";} If (num = 3)<!--写第四条边-->{Tl = left;<!--左边界-->Tt = top + height;<!--上边界-->Tw = height;<!--高度-->Th = w * width;<!--宽度-->S ="<table +tl+"px; top: "+tt+"px; width: "+tw+"px; height: "+th+"px;' cellspacing='0' cellpadding='0'>"; for(r=w;r>0; r --)<!--依次画出每一个小格-->{Temp = r-1 + w * num; s + ="<tr><td id=tab"+temp+" bgcolor=red></td></tr>";<!--写入小格-->} S + ="</table>";} Return s;<!--返回s-->} Function count () {var I; var temp; var total;<!--定义变量-->Total = w * 4;<!--小格的总数-->For (I = 0; I<line.length; i++)<!--处理当前小格前后各10个点-->{Temp = pos + i-line.length/2;<!--获取当前处理的点-->Temp = temp <0? (Total + temp): temp;<!--如果小于0,则循环到后边-->Temp = temp> (total-1 )? (Temp-total): temp;<!--如果大于总数,则循环到前面-->Document. all ["tab" + temp]. style. backgroundColor = line [line. length-I];<!--给小格上适当的颜色-->} Pos = (pos + 1)> total? 0: (pos + 1 );<!--pos加1,如果pos超过小格的总数,则重头开始-->} For (I = 0; I <= 3; I ++) {document. write (writes (I ));<!--依次处理方框的每一条边-->} Var pos = 0;<!--初始化变量-->SetInterval ("count ()", 1 );<!--调用count函数--></script><!--本例程实现了走在方框上的雾--><!--雾的动画效果的实现--><!--用表格的形式来画边框,便于精确的颜色控制--><!--setinterval函数的使用-->
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.