(1)编辑一个html
1 <form> 2 <div class="board"> 3 <div id="scorebar">Your scores: </div> 4 <input id="bonus_01" name="radio1" class="bonus" type="radio"> 5 <input id="bonus_02" name="radio2" class="bonus" type="radio"> 6 <input id="bonus_03" name="radio3" class="bonus" type="radio"> 7 <input id="bonus_04" name="radio4" class="bonus" type="radio"> 8 <input id="bonus_05" name="radio5" class="bonus" type="radio"> 9 <input id="bonus_06" name="radio6" class="bonus" type="radio"> 10 <input id="bonus_07" name="radio7" class="bonus" type="radio"> 11 <input id="bonus_08" name="radio8" class="bonus" type="radio"> 12 <input id="bonus_09" name="radio9" class="bonus" type="radio"> 13 <input id="bonus_10" name="radio10" class="bonus" type="radio"> 14 <p class="enemy" id="enemy_01"></p> 15 <p class="enemy" id="enemy_02"></p> 16 <p class="enemy" id="enemy_03"></p> 17 <p class="enemy enemy_t1" id="enemy_04"></p> 18 <p class="enemy" id="enemy_05"></p> 19 <p class="enemy" id="enemy_06"></p> 20 <p class="enemy enemy_t3" id="enemy_07"></p> 21 <p class="enemy" id="enemy_08"></p> 22 <p class="enemy" id="enemy_09"></p> 23 <p class="enemy" id="enemy_10"></p> 24 <p class="enemy enemy_t1" id="enemy_11"></p> 25 <p class="enemy" id="enemy_12"></p> 26 <p class="enemy" id="enemy_13"></p> 27 <p class="enemy enemy_t2" id="enemy_14"></p> 28 <p class="enemy" id="enemy_15"></p> 29 <p class="enemy" id="enemy_16"></p> 30 <p class="enemy enemy_t3" id="enemy_17"></p> 31 <p class="enemy" id="enemy_18"></p> 32 <p class="enemy" id="enemy_19"></p> 33 <p class="enemy enemy_t3" id="enemy_20"></p> 34 <p class="enemy" id="enemy_21"></p> 35 <p class="enemy" id="enemy_22"></p> 36 <p class="enemy enemy_t1" id="enemy_23"></p> 37 <p class="enemy" id="enemy_24"></p> 38 <p class="enemy enemy_t2" id="enemy_25"></p> 39 <p class="enemy" id="enemy_26"></p> 40 <p class="enemy" id="enemy_27"></p> 41 <p class="enemy enemy_t3" id="enemy_28"></p> 42 <p class="enemy" id="enemy_29"></p> 43 <p class="enemy" id="enemy_30"></p> 44 <p class="enemy" id="enemy_31"></p> 45 <p class="enemy" id="enemy_32"></p> 46 <p class="enemy" id="enemy_33"></p> 47 <p class="enemy" id="enemy_34"></p> 48 <p class="enemy" id="enemy_35"></p> 49 <p class="enemy" id="enemy_36"></p> 50 <p class="enemy" id="enemy_37"></p> 51 <p class="enemy" id="enemy_38"></p> 52 <p class="enemy enemy_t3" id="enemy_39"></p> 53 <p class="enemy" id="enemy_40"></p> 54 <p class="enemy" id="enemy_41"></p> 55 <p class="enemy" id="enemy_42"></p> 56 <p class="enemy" id="enemy_43"></p> 57 <p class="enemy enemy_t2" id="enemy_44"></p> 58 <p class="enemy" id="enemy_45"></p> 59 <p class="enemy" id="enemy_46"></p> 60 <p class="enemy enemy_t1" id="enemy_47"></p> 61 <p class="enemy" id="enemy_48"></p> 62 <p class="enemy" id="enemy_49"></p> 63 <p class="enemy" id="enemy_50"></p> 64 <p id="finish">Congratulations! You just played a game that is written in JS and contains a total of 0 lines of code.</p> 65 <p id="status"><strong>Help:</strong> <span class="inactive">move cursor to the field.</span><span class="active">Ships fly around the halls, click on bonuses!</span></p> 66 </div> 67 </form>
(2)编辑一个css
1 @import "http://nojsgame.majorov.su/bg.css"; 2 3 * { 4 margin: 0; 5 padding: 0; 6 } 7 8 .board { 9 width: 400px; 10 height: 600px; 11 margin: 0 auto; 12 background: #69c url(http://nojsgame.majorov.su/bg.jpg); 13 cursor: url('http://nojsgame.majorov.su/r2.png') 35 0,pointer; 14 text-align: center; 15 position: relative; 16 } 17 18 #scorebar { 19 float: left; 20 color: #fff; 21 } 22 23 .board #status { 24 color: #fff; 25 position: absolute; 26 bottom: 15px; 27 left: 5px; 28 font-size: 14px; 29 } 30 31 .board #status span.active { 32 display: none; 33 } 34 35 .board #status span.inactive { 36 display: inline; 37 } 38 39 .board:hover #status span.active { 40 display: inline; 41 } 42 43 .board:hover #status span.inactive { 44 display: none; 45 } 46 47 .enemy { 48 height: 64px; 49 width: 64px; 50 margin-right: 5px; 51 margin-top: 15px; 52 position: absolute; 53 top: -50%; 54 left: 0; 55 background: url(http://nojsgame.majorov.su/e6.png); 56 } 57 58 .enemy_t1 { 59 height: 48px; 60 width: 48px; 61 background: url(http://nojsgame.majorov.su/e4.png); 62 } 63 64 .enemy_t2 { 65 height: 64px; 66 width: 64px; 67 background: url(http://nojsgame.majorov.su/e2.png); 68 } 69 70 .enemy_t3 { 71 height: 128px; 72 width: 128px; 73 background: url(http://nojsgame.majorov.su/e3.png); 74 } 75 76 .bonus { 77 height: 24px; 78 width: 24px; 79 position: absolute; 80 top: -10%; 81 left: 0; 82 background-image: url(http://nojsgame.majorov.su/b1.png); 83 -moz-appearance: button; 84 -webkit-appearance: button; 85 appearance: button; 86 } 87 88 .bonus:checked { 89 background-image: url('http://nojsgame.majorov.su/b2.png') !important; 90 width: 24px; 91 height: 24px; 92 position: static; 93 -webkit-animation-name: none; 94 animation-name: none; 95 float: left; 96 } 97 98 .board .enemy:hover { 99 border-radius: 0; 100 margin: 0; 101 height: 600px; 102 width: 400px; 103 position: absolute; 104 top: 0; 105 left: 0; 106 z-index: 999; 107 background: #f00; 108 overflow: visible; 109 cursor: not-allowed; 110 -webkit-animation: animation1 0s 0s linear !important; 111 animation: animation1 0s 0s linear !important; 112 -webkit-animation: animation2 0s 0s linear !important; 113 animation: animation2 0s 0s linear !important; 114 -webkit-animation: animation3 0s 0s linear !important; 115 animation: animation3 0s 0s linear !important; 116 -webkit-animation: animation4 0s 0s linear !important; 117 animation: animation4 0s 0s linear !important; 118 -webkit-animation: animation5 0s 0s linear !important; 119 animation: animation5 0s 0s linear !important; 120 -webkit-animation: animation6 0s 0s linear !important; 121 animation: animation6 0s 0s linear !important; 122 -webkit-animation: animation7 0s 0s linear !important; 123 animation: animation7 0s 0s linear !important; 124 -webkit-animation: animation8 0s 0s linear !important; 125 animation: animation8 0s 0s linear !important; 126 -webkit-animation: animation9 0s 0s linear !important; 127 animation: animation9 0s 0s linear !important; 128 -webkit-animation: animation10 0s 0s linear !important; 129 animation: animation10 0s 0s linear !important; 130 } 131 132 .board .enemy:hover:before { 133 background: #f00; 134 content: "GAME OVER!"; 135 top: 100px; 136 left: 0; 137 width: 400px; 138 color: #fff; 139 text-shadow: 1px 1px 1px #aaa; 140 box-shadow: none; 141 } 142 143 .board .enemy:hover:after { 144 display: none; 145 } 146 147 .board .bonus:hover { 148 cursor: crosshair; 149 zoom: 2; 150 } 151 152 .board:hover #bonus_01 { 153 -webkit-animation: animation3 8s 2s linear; 154 animation: animation3 8s 2s linear; 155 } 156 157 .board:hover #bonus_02 { 158 -webkit-animation: animation4 12s 4s linear; 159 animation: animation4 12s 4s linear; 160 } 161 162 .board:hover #bonus_03 { 163 -webkit-animation: animation8 16s 6s linear; 164 animation: animation8 16s 6s linear; 165 } 166 167 .board:hover #bonus_04 { 168 -webkit-animation: animation2 16s 10s linear; 169 animation: animation2 16s 10s linear; 170 } 171 172 .board:hover #bonus_05 { 173 -webkit-animation: animation9 14s 15s linear; 174 animation: animation9 14s 15s linear; 175 } 176 177 .board:hover #bonus_06 { 178 -webkit-animation: animation7 12s 20s linear; 179 animation: animation7 12s 20s linear; 180 } 181 182 .board:hover #bonus_07 { 183 -webkit-animation: animation1 8s 26s linear; 184 animation: animation1 8s 26s linear; 185 } 186 187 .board:hover #bonus_08 { 188 -webkit-animation: animation3 10s 30s linear; 189 animation: animation3 10s 30s linear; 190 } 191 192 .board:hover #bonus_09 { 193 -webkit-animation: animation7 16s 40s linear; 194 animation: animation7 16s 40s linear; 195 } 196 197 .board:hover #bonus_10 { 198 -webkit-animation: animation4 16s 45s linear; 199 animation: animation4 16s 45s linear; 200 } 201 202 .board:hover #enemy_01 { 203 -webkit-animation: animation1 6s 0s linear; 204 animation: animation1 6s 0s linear; 205 } 206 207 .board:hover #enemy_02 { 208 -webkit-animation: animation2 5s 2s linear; 209 animation: animation2 5s 2s linear; 210 } 211 212 .board:hover #enemy_03 { 213 -webkit-animation: animation3 3s 3s linear; 214 animation: animation3 3s 3s linear; 215 } 216 217 .board:hover #enemy_04 { 218 -webkit-animation: animation4 6s 4s linear; 219 animation: animation4 6s 4s linear; 220 } 221 222 .board:hover #enemy_05 { 223 -webkit-animation: animation5 4s 5s linear; 224 animation: animation5 4s 5s linear; 225 } 226 227 .board:hover #enemy_06 { 228 -webkit-animation: animation2 3s 6s linear; 229 animation: animation2 3s 6s linear; 230 } 231 232 .board:hover #enemy_07 { 233 -webkit-animation: animation7 2s 8s linear; 234 animation: animation7 2s 8s linear; 235 } 236 237 .board:hover #enemy_08 { 238 -webkit-animation: animation4 5s 8s linear; 239 animation: animation4 5s 8s linear; 240 } 241 242 .board:hover #enemy_09 { 243 -webkit-animation: animation8 3s 9s linear; 244 animation: animation8 3s 9s linear; 245 } 246 247 .board:hover #enemy_10 { 248 -webkit-animation: animation6 4s 10s linear; 249 animation: animation6 4s 10s linear; 250 } 251 252 .board:hover #enemy_11 { 253 -webkit-animation: animation1 6s 10s linear; 254 animation: animation1 6s 10s linear; 255 } 256 257 .board:hover #enemy_12 { 258 -webkit-animation: animation6 4s 11s linear; 259 animation: animation6 4s 11s linear; 260 } 261 262 .board:hover #enemy_13 { 263 -webkit-animation: animation2 8s 12s linear; 264 animation: animation2 8s 12s linear; 265 } 266 267 .board:hover #enemy_14 { 268 -webkit-animation: animation9 4s 13s linear; 269 animation: animation9 4s 13s linear; 270 } 271 272 .board:hover #enemy_15 { 273 -webkit-animation: animation3 5s 13s linear; 274 animation: animation3 5s 13s linear; 275 } 276 277 .board:hover #enemy_16 { 278 -webkit-animation: animation10 7s 14s linear; 279 animation: animation10 7s 14s linear; 280 } 281 282 .board:hover #enemy_17 { 283 -webkit-animation: animation7 3s 15s linear; 284 animation: animation7 3s 15s linear; 285 } 286 287 .board:hover #enemy_18 { 288 -webkit-animation: animation3 5s 16s linear; 289 animation: animation3 5s 16s linear; 290 } 291 292 .board:hover #enemy_19 { 293 -webkit-animation: animation6 4s 16s linear; 294 animation: animation6 4s 16s linear; 295 } 296 297 .board:hover #enemy_20 { 298 -webkit-animation: animation1 3s 17s linear; 299 animation: animation1 3s 17s linear; 300 } 301 302 .board:hover #enemy_21 { 303 -webkit-animation: animation2 4s 17s linear; 304 animation: animation2 4s 17s linear; 305 } 306 307 .board:hover #enemy_22 { 308 -webkit-animation: animation1 5s 18s linear; 309 animation: animation1 5s 18s linear; 310 } 311 312 .board:hover #enemy_23 { 313 -webkit-animation: animation4 9s 19s linear; 314 animation: animation4 9s 19s linear; 315 } 316 317 .board:hover #enemy_24 { 318 -webkit-animation: animation9 2s 20s linear; 319 animation: animation9 2s 20s linear; 320 } 321 322 .board:hover #enemy_25 { 323 -webkit-animation: animation7 3s 20s linear; 324 animation: animation7 3s 20s linear; 325 } 326 327 .board:hover #enemy_26 { 328 -webkit-animation: animation1 5s 20s linear; 329 animation: animation1 5s 20s linear; 330 } 331 332 .board:hover #enemy_27 { 333 -webkit-animation: animation9 6s 21s linear; 334 animation: animation9 6s 21s linear; 335 } 336 337 .board:hover #enemy_28 { 338 -webkit-animation: animation3 3s 22s linear; 339 animation: animation3 3s 22s linear; 340 } 341 342 .board:hover #enemy_29 { 343 -webkit-animation: animation6 4s 23s linear; 344 animation: animation6 4s 23s linear; 345 } 346 347 .board:hover #enemy_30 { 348 -webkit-animation: animation4 5s 24s linear; 349 animation: animation4 5s 24s linear; 350 } 351 352 .board:hover #enemy_31 { 353 -webkit-animation: animation9 4s 24s linear; 354 animation: animation9 4s 24s linear; 355 } 356 357 .board:hover #enemy_32 { 358 -webkit-animation: animation6 2s 25s linear; 359 animation: animation6 2s 25s linear; 360 } 361 362 .board:hover #enemy_33 { 363 -webkit-animation: animation3 3s 26s linear; 364 animation: animation3 3s 26s linear; 365 } 366 367 .board:hover #enemy_34 { 368 -webkit-animation: animation4 5s 26s linear; 369 animation: animation4 5s 26s linear; 370 } 371 372 .board:hover #enemy_35 { 373 -webkit-animation: animation10 8s 27s linear; 374 animation: animation10 8s 27s linear; 375 } 376 377 .board:hover #enemy_36 { 378 -webkit-animation: animation2 3s 27s linear; 379 animation: animation2 3s 27s linear; 380 } 381 382 .board:hover #enemy_37 { 383 -webkit-animation: animation7 2s 28s linear; 384 animation: animation7 2s 28s linear; 385 } 386 387 .board:hover #enemy_38 { 388 -webkit-animation: animation4 5s 28s linear; 389 animation: animation4 5s 28s linear; 390 } 391 392 .board:hover #enemy_39 { 393 -webkit-animation: animation1 3s 29s linear; 394 animation: animation1 3s 29s linear; 395 } 396 397 .board:hover #enemy_40 { 398 -webkit-animation: animation6 4s 30s linear; 399 animation: animation6 4s 30s linear; 400 } 401 402 .board:hover #enemy_41 { 403 -webkit-animation: animation9 4s 24s linear; 404 animation: animation9 4s 24s linear; 405 } 406 407 .board:hover #enemy_42 { 408 -webkit-animation: animation6 2s 25s linear; 409 animation: animation6 2s 25s linear; 410 } 411 412 .board:hover #enemy_43 { 413 -webkit-animation: animation3 3s 26s linear; 414 animation: animation3 3s 26s linear; 415 } 416 417 .board:hover #enemy_44 { 418 -webkit-animation: animation4 5s 26s linear; 419 animation: animation4 5s 26s linear; 420 } 421 422 .board:hover #enemy_45 { 423 -webkit-animation: animation10 8s 27s linear; 424 animation: animation10 8s 27s linear; 425 } 426 427 .board:hover #enemy_46 { 428 -webkit-animation: animation2 3s 27s linear; 429 animation: animation2 3s 27s linear; 430 } 431 432 .board:hover #enemy_47 { 433 -webkit-animation: animation7 2s 28s linear; 434 animation: animation7 2s 28s linear; 435 } 436 437 .board:hover #enemy_48 { 438 -webkit-animation: animation4 5s 28s linear; 439 animation: animation4 5s 28s linear; 440 } 441 442 .board:hover #enemy_49 { 443 -webkit-animation: animation1 3s 29s linear; 444 animation: animation1 3s 29s linear; 445 } 446 447 .board:hover #enemy_50 { 448 -webkit-animation: animation6 4s 30s linear; 449 animation: animation6 4s 30s linear; 450 } 451 452 @-webkit-keyframes animation1 { 453 0% { 454 left: 260px; 455 top: -10%; 456 } 457 458 100% { 459 left: 260px; 460 top: 100%; 461 } 462 } 463 464 @-webkit-keyframes animation2 { 465 0% { 466 left: 50px; 467 top: -10%; 468 } 469 470 100% { 471 left: 50px; 472 top: 100%; 473 } 474 } 475 476 @-webkit-keyframes animation3 { 477 0% { 478 left: 150px; 479 top: -10%; 480 } 481 482 100% { 483 left: 200px; 484 top: 100%; 485 } 486 } 487 488 @-webkit-keyframes animation4 { 489 0% { 490 left: 300px; 491 top: -10%; 492 } 493 494 100% { 495 left: 200px; 496 top: 100%; 497 } 498 } 499 500 @-webkit-keyframes animation5 { 501 0% { 502 left: 150px; 503 top: -10%; 504 } 505 506 100% { 507 left: 150px; 508 top: 100%; 509 } 510 } 511 512 @-webkit-keyframes animation6 { 513 0% { 514 left: 50px; 515 top: -10%; 516 } 517 518 100% { 519 left: 250px; 520 top: 100%; 521 } 522 } 523 524 @-webkit-keyframes animation7 { 525 0% { 526 left: 300px; 527 top: -10%; 528 } 529 530 100% { 531 left: 0; 532 top: 100%; 533 } 534 } 535 536 @-webkit-keyframes animation8 { 537 0% { 538 left: 0; 539 top: -10%; 540 } 541 542 100% { 543 left: 300px; 544 top: 100%; 545 } 546 } 547 548 @-webkit-keyframes animation9 { 549 0% { 550 left: 200px; 551 top: -10%; 552 } 553 554 100% { 555 left: 150px; 556 top: 100%; 557 } 558 } 559 560 @-webkit-keyframes animation10 { 561 0% { 562 left: 250px; 563 top: -10%; 564 } 565 566 100% { 567 left: 100px; 568 top: 100%; 569 } 570 } 571 572 @-webkit-keyframes animation99 { 573 0% { 574 left: 50px; 575 top: -40%; 576 } 577 578 100% { 579 left: 50px; 580 top: 30%; 581 } 582 } 583 584 @keyframes animation1 { 585 0% { 586 left: 260px; 587 top: -10%; 588 } 589 590 100% { 591 left: 260px; 592 top: 100%; 593 } 594 } 595 596 @keyframes animation2 { 597 0% { 598 left: 50px; 599 top: -10%; 600 } 601 602 100% { 603 left: 50px; 604 top: 100%; 605 } 606 } 607 608 @keyframes animation3 { 609 0% { 610 left: 150px; 611 top: -10%; 612 } 613 614 100% { 615 left: 200px; 616 top: 100%; 617 } 618 } 619 620 @keyframes animation4 { 621 0% { 622 left: 300px; 623 top: -10%; 624 } 625 626 100% { 627 left: 200px; 628 top: 100%; 629 } 630 } 631 632 @keyframes animation5 { 633 0% { 634 left: 150px; 635 top: -10%; 636 } 637 638 100% { 639 left: 150px; 640 top: 100%; 641 } 642 } 643 644 @keyframes animation6 { 645 0% { 646 left: 50px; 647 top: -10%; 648 } 649 650 100% { 651 left: 250px; 652 top: 100%; 653 } 654 } 655 656 @keyframes animation7 { 657 0% { 658 left: 300px; 659 top: -10%; 660 } 661 662 100% { 663 left: 0; 664 top: 100%; 665 } 666 } 667 668 @keyframes animation8 { 669 0% { 670 left: 0; 671 top: -10%; 672 } 673 674 100% { 675 left: 300px; 676 top: 100%; 677 } 678 } 679 680 @keyframes animation9 { 681 0% { 682 left: 200px; 683 top: -10%; 684 } 685 686 100% { 687 left: 150px; 688 top: 100%; 689 } 690 } 691 692 @keyframes animation10 { 693 0% { 694 left: 250px; 695 top: -10%; 696 } 697 698 100% { 699 left: 100px; 700 top: 100%; 701 } 702 } 703 704 @keyframes animation99 { 705 0% { 706 left: 50px; 707 top: -40%; 708 } 709 710 100% { 711 left: 50px; 712 top: 30%; 713 } 714 } 715 716 .board #finish { 717 position: absolute; 718 top: -40%; 719 left: 50px; 720 text-align: center; 721 display: none; 722 width: 200px; 723 padding: 20px 50px; 724 background: #fff; 725 box-shadow: 4px 4px 4px #ccc; 726 border-radius: 10px; 727 } 728 729 .board:hover #finish { 730 -webkit-animation: animation99 5s 30s linear; 731 animation: animation99 5s 30s linear; 732 animation-fill-mode: forwards; 733 display: block; 734 }