我必须执行一个动画,其中切换两个图像。图片ID是image_anim
。getElementById给出错误
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Chill</title>
<link rel="stylesheet" type="text/css" href="../css/Start_Page_css.css"/>
<script src="../Java_Script/button_click.js"></script>
<script type="text/javascript">
var boxOne = document.getElementsById("image_anim");
setTimeout(function()
{
for (var i=0;i<4;i++) {
setTimeout(function()
{
setTimeout(function()
{
boxOne.src="../Images/p1.png";
},250);
setTimeout(function()
{
boxOne.src="../Images/p2.png";
},250);
},500);
};
}, 3000);</script>
</head>
<body ng-app="app">
<div class="container" >
<div class="table_set_up_conn">
<div class="set_up_conn">SETTING UP YOUR CONNECTION</div>
</div>
<div class="table_image_anim">
<img id="#image_anim" src="../Images/p1.png"/>
</div>
<div class="grey_layout_anim">
<div class="bold_write"><br>Now let's connect to your Clipsal Hub</div>
<div class="norm_write">1. Go to the Wi-Fi settings on your phone<br><br>2. Connect to the Clipsal Hub network<br><br>3. Return to this app when you're done<br><br></div>
</div>
<div class="table_centre_image">
<img id="#centre_image" src="../Images/p2.png"/>
</div>
</div>
</body>
</html>
的错误是
Uncaught TypeError: undefined is not a function .
Function is :getElementsById
getElementsById它的getElementById – 2014-11-06 11:09:33
简单,没有getElementsById方法 – 2014-11-06 11:09:33
@Pallavi我投票决定关闭的问题,因为它没有进一步相关的任何人你解决你的后自己的代码。你怎么自己发现这些错误?在您的浏览器中,打开[Web控制台](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)。通常它会向您显示出错的地方(包括线路)。 – Boldewyn 2014-11-06 11:12:20