<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </head> <body> <div style="font-family:'宋体'; font-size:16px; line-height:16px; word-break: break-all; word-wrap: break-word; width:19.5em; padding:0.5em 0 0.5em 0.5em; background-color:#ca6"> <script type="text/javascript"> function qi(q){ var t=["┏","┯","┓ ","┠","┼","┨ ","┗","┷","┛","╋"],text=[]; for(y=0;y<19;y++){ for (x=0;x<19;x++){ var s=(x%18?0:(x-9)/9)+1+((y%18?0:(y-9)/9)+1)*3 +((x-3)%6?0:1)*((y-3)%6?0:5); text.push(t[s]); } } if(q){ for(i=0;i<q.length;i++){ text[(q[i].y-1)*19-1+q[i].x]=i%2?"<font color=white>●</font>":"●"; } } return text.join(""); } var q=[{x:5,y:5}, {x:7,y:7}, {x:6,y:7}, {x:6,y:8}, {x:6,y:5}, {x:6,y:6}, {x:7,y:6}]; document.write(qi(q)); </script> </div> </body> </html>(鼠标移到代码上去,在代码的顶部会出现四个图标,第一个是查看源代码,第二个是复制代码,第三个是打印代码,第四个是帮助)
今天看到一段javascript画的围棋的代码,很有趣的,转到这里与大家共享,以提高大学学习javascript的兴趣。