用JavaScript写的贪吃蛇游戏(很简单,很详细)
效果 编写外部框架 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } #box{ width:620px; height:450px; position:absolute; margin:0 auto; left:0; top:20px; right:0; bottom:0; background:gray; border-radius:10px; } #snakeDiv{ width:600px; height:400px; position:absolute; margin:0 auto; left:0; top:10px; right:0; bottom:0; } .bottom{ width:600px; height:30px; position:absolute; bottom:1px; right:1px; } .bottom .button1{ position: absolute; right: 90px; width: 50px; font-size: 14px; } .bottom .button2{ position: absolute; right: 30px; width: