上周发布了‘jquery开发的数独游戏’,下载量很多评论的人很少。近期会将主要的开发思路整理出来与大家交流,非常希望与大家通过这个例子共同探讨和学习。
另外最近时间允许的情况下会移植到html5,暂定名称为H5sukudo主要目的也是练手。
 
body的代码如下,页面主体使用main层来控制尺寸,main中包含两个层:canvas和tools,分别用来承载数独表格和辅助信息。
tools层中嵌套了logo,level,lefts,timer,leftsg,btns,err共七个层,分别用来承载LOGO、游戏难度、剩余空格数、已用时间、剩余空格数明细、按钮和错误提示信息。
tools层中的样式写在default.css样式文件中。
canvas层、level层、lefts层、timer层、leftsg层、err层的内容由jquery控制动态生成,后续会有解释。
<body onselectstart="return false" oncopy="return false" oncut="return false">
    <center>
        <div >
            <div  style='width: 540px; height: 540px; float: left'>
            </div>
            <div >
                <div >
                    JSUKUDO
                </div>
                <div >
                    Level:
                </div>
                <div >
                </div>
                <div >
                    Timer:
                </div>
                <div >
                </div>
                <div >
                    <input type='button' value='Easy' onclick="$(g.canvas).gensukudo(2);$('#level').html('LEVEL:'+$(this).val());">
                    <br />
                    <input type='button' value='Medium' onclick="$(g.canvas).gensukudo(3);$('#level').html('LEVEL:'+$(this).val());">
                    <br />
                    <input type='button' value='Hard' onclick="$(g.canvas).gensukudo(4);$('#level').html('LEVEL:'+$(this).val());">
                    <br />
                    <input type='button' value='Restart' style="display: none;" onclick="$('#SukudoTable').fadeOut(500);$('.c').each(function(){if(this.num()!=0)$(this).setempty().check();});$('#SukudoTable').fadeIn(500);">
                    <br />
                    <br />
                    <b><a href="#" onclick="$(g.canvas).unblock().block({ message: gameintruce, css: {width:'480px', border: '3px solid #a00' } });">
                        GameIntroduce</a> <a href="#" onclick="$(g.canvas).unblock().block({ message: aboutgame, css: {width:'400px', border: '3px solid #a00' } });">
                            AboutSoftware</a> </b>
                </div>
                <div >
                </div>
            </div>
    </center>
</body>

Jquery数独游戏解析(一)-页面布局

相关文章:

  • 2022-01-07
  • 2022-12-23
  • 2022-03-05
  • 2022-02-11
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2022-01-24
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案