使用javascript匹配游戏

时间:2015-09-30 02:03:31

标签: javascript

我制作游戏时游戏的逻辑是匹配给定的单词,但它使用的是图像。

如何使用图片验证它?



< script >
  var e = document.getElementById("E");
var n = document.getElementById("N");
var d = document.getElementById("D");
/*move img_letter*/
//E
function move_E() {
  e.onclick = function() {
    e.style.bottom = "300px"
    e.style.left = "320px"
  }
};
//N
function move_N() {
  n.onclick = function() {
    n.style.bottom = "300px"
    n.style.left = "550px"
  }
};
//D
function move_D() {
  d.onclick = function() {
    d.style.bottom = "300px"
    d.style.left = "780px"
  }
};
window.onload = function() {
  move_E();
  move_N();
  move_D();
}

< /script>
&#13;
<html>

<head>
</head>
<style>
  #D {
    margin-left: -3%;
    position: absolute;
  }
  #N {
    margin-left: 5%;
    position: absolute;
  }
  #E {
    margin-left: 13%;
    position: absolute;
  }
  .img_letter {
    margin-top: 25%;
    margin-left: 40%;
  }
</style>

<body>
  <h1 align="center">END</h1>
  <div class="img_letter">
    <div id="N">
      <img src="http://i62.tinypic.com/2rx8qjb_th.png" width="100px" height="100px">
    </div>
    <div id="E">
      <img src="http://i61.tinypic.com/2qny5xx_th.png" width="100px" height="100px">
    </div>
    <div id="D">
      <img src="http://i57.tinypic.com/2554dfk_th.png" width="100px" height="100px">
    </div>
  </div>

</body>

</htmL>
&#13;
&#13;
&#13;

0 个答案:

没有答案