我的编码有什么问题,因为我想创建一个动画? [英] What is wrong in my coding as I want to create an animation?

查看:58
本文介绍了我的编码有什么问题,因为我想创建一个动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<!DOCTYPE html>

var c=new Array("https://i.pinimg.com/736x/29/77/ee/2977ee03f8c36bf71f0e4acc22738c7d--indian-gods-indian-art.jpg","https://i.pinimg.com/736x/b8/be/f5/b8bef5902e49262e301b4134ae48fb9b--ganesha-paintings-ganesha-art.jpg","https://i.pinimg.com/736x/6d/86/5f/6d865f3d83f6003643e27b2ae00317da--shiva-hindu-hindu-art.jpg");
var i=1;
var ref;

function picture() {
    document.images[0].src=c[i];
    i++;

    if(i>2)
        i=0;
}

fuction start() {
    ref=setInterval("picture()",1000)
}

function stop() {
    clearInterval(ref);
}





我的尝试:



不,我没有尝试任何东西,只是看到我可以修复我的地方。我想用这些图像创建动画。



What I have tried:

No I haven't tried anything but just saw where i could fix mine.I want to create animation using those images.

推荐答案

首先,这不是HTML。这是javascript。



接下来,你拼错了function作为fuction并且在同一个函数中的ref =行上缺少分号,并且.. .that setInterval函数调用。您的呼叫功能不能用引号括起来。它应该只是:

First, this isn't HTML. It's javascript.

Next, you misspelled "function" as "fuction" and are missing the semicolon on the "ref=" line in the same function, and...that setInterval function call. The function your calling cannot be in quotes. It should be just:
ref = setInterval(picture, 1000);


这篇关于我的编码有什么问题,因为我想创建一个动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆