本帖最後由 張彥承 於 2014-7-21 16:00 編輯
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Legend is a genious</title>
- <!-- 引用 Bootstrap 素材與jQuery -->
- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
- <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3">
- <h1>Legion's Legend</h1>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3">
- <div id="year" class="input-group">
- <span class="input-group-addon">出生年</span>
- <input id="year" class="form-control" />
- <span class="input-group-addon">年</span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3">
- <div id="month" class="input-group">
- <span class="input-group-addon">出生月</span>
- <input class="form-control" />
- <span class="input-group-addon">月</span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3">
- <div id="day" class="input-group">
- <span class="input-group-addon">出生日</span>
- <input class="form-control" />
- <span class="input-group-addon">日</span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3">
- <button id="btn" type="button" class="btn btn-primary btn-lg btn-block">開始占卜
- </button>
- </div>
- </div>
-
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-sm-offset-3" style="margin-top:50px;">
- <span style="font-size:50pt" class="label label-success">吉</span>
- <span style="font-size:50pt" class="label label-info">普</span>
- <span style="font-size:50pt" class="label label-danger">凶</span>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $("#btn").click(calc);
- function calc()
- {
- var y=parseInt($("#year").val());
- var m=parseInt($("#month").val());
- var d=parseInt($("#day").val());
- var r=(y*m*d)%3
- $("#r0").hide();
- $("#r1").hide();
- $("#r2").hide();
- $("#r"+r).fadeIn();
- }
- </script>
- </body>
- </html>
複製代碼 |