Java Web 8乘8国际象棋棋盘

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>国际象棋棋盘</title>
</head>
<body>
	<script>
		document.write("<table width=400 height=400 border=1>");
		for(var i=1;i<=8;i++){
			document.write("<tr>");
			for(var j=1;j<=8;j++){
				if((i+j)%2==0){				
					document.write("<td bgcolor='white'></td>");
				}else{
					document.write("<td bgcolor='black'></td>");
				}				
			}
			document.write("</tr>");
		}
		document.write("</table>");	 		
	</script>
</body>
</html>

结果如下

发布了35 篇原创文章 · 获赞 5 · 访问量 861

猜你喜欢

转载自blog.csdn.net/m0_43443133/article/details/104667844
今日推荐