使用JavaScript和CSS实现不同行颜色的九九乘法表

源代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>乘法九九表</title>
<style>
table{
	background-color: grey;
}
#odd{
background-color:blue ;
}
#even{
background-color: red;
}
</style>
</head>
<body>
	<script type="text/javascript">
		document.write("")for(var i =1; i <10; i++){
			document.write("")for(var j =1; j <= i; j++){if(i%2==0){
					document.write("")}elseif(i%2!=0){
					document.write("")}}
			document.write("")}
		document.write("
") document.write(j + "*" + i + "=" + j * i + " "); document.write(" ") document.write(j + "*" + i + "=" + j * i + " "); document.write("
"
) </script> </body> </html>

运行截图:
使用JavaScript和CSS实现不同行颜色的九九乘法表_第1张图片

你可能感兴趣的:(前端)