Jason_Yu 发表于 2012-12-22 21:28:20

【javascript】拼图小游戏

【javascript】拼图小游戏

<div id="cnblogs_post_body">兴趣才是学习的动力源泉。一直喜欢游戏类的编程,因为觉得好玩。。。
周末这2天准备写个拼图的小游戏,只为学习面向对象,虽然对面向对象里的很多东西还不太熟悉。
昨天(星期六)开始写了界面,写着写着,感觉困了就睡觉去了^ ^,今天早上起来把它完成了,顺便在博客里记载下来,下次不懒的时候,再加点动画效果。
下面是HTML部分,用了一个bg.jpg的图片。
<div class="cnblogs_code"><!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" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /><title></title><style type="text/css">*{margin:0;padding:0;}#box{width:480px;height:480px;border:5px solid #ccc;position:relative;margin:20px auto 0;}#box div{background:url(bg.jpg) no-repeat;width:158px;height:158px;border:1px dashed #fafafa;position:absolute;}#box .on{width:158px;height:158px;border:1px solid #ff0;}#box img{position:absolute;top:0;left:0;width:480px;height:480px;display:none;}#box span{position:absolute;top:420px;left:490px;background:#ccc;width:60px;height:30px;color:#000;line-height:30px;text-align:center;cursor:pointer;}</style></head><body><div id="box">    <div></div>    <div></div>    <div></div>    <div></div>    <div></div>    <div></div>    <div></div>    <div></div>    <div></div>    <img src="bg.jpg" alt="" />    <span>view</span></div><script type="text/javascript" src="effect.js"></script></body></html>
页: [1]
查看完整版本: 【javascript】拼图小游戏