显示索引或大小的结果为负或大于允许的金额

时间:2014-06-11 12:25:30

标签: javascript animation canvas

Firefox显示此错误:

  

索引或大小为负数或大于允许的数量

执行此代码时:

   function myDraw(x1,y1){      
        var img1 = document.createElement('img');
        img1.src='i12.png'; 
        img1.onload = function (){
        var c=document.getElementById('myCanvas');
        var ctx=c.getContext('2d');     
        ctx.drawImage(img1,0,0,y1,x1,5,5,y1,x1);
        }       
        var sizeArrey =[1,13,25,37,49,61,73,85,97,109, 125,140];
        for (var i = 0; i < sizeArrey.length; i++ ){            
        y1 = sizeArrey[i];}
        x1 += 2;              
        var loopTimer = setTimeout('myDraw('+x1+','+y1+')', 7);
}
function myDraw1(x11, y11){
    var img=document.createElement('img');
    img.src='logo11.png'; 
        img.onload = function (){
            var c=document.getElementById('myCanvas');
            var ctx=c.getContext('2d');     
            ctx.drawImage(img,0,0,x11,50,125,55,x11,50); 
            }   
     x11 += 1;  
     var loopTimer = setTimeout('myDraw1('+x11+','+y11+')', 3 );        
}
myDraw(0,0)
setTimeout("myDraw1(0,0)",1400);

请帮帮我,这里有什么问题?

0 个答案:

没有答案