开发者

Uncaught ReferenceError: loadNext is not defined (anonymous function)

I am getting this error

Uncaught ReferenceError: loadNext is not defined
(anonymous function)

The line that is causing this is

<img name="imageLoad" class="hiddenPic" src="<?php echo "albums/$folder/$startImage"; ?>" onLoad="javascript:loadNext();" />

It refers to this function above the image tag.

function loadNext() {
    ///alert("maxphoto="+maxPhoto+"start="+start+"loadingindex"+loadingIndex);
    loadingIndex = nextPhotoToLoad(1, maxPhoto,start, l开发者_StackOverflowoadingIndex);
    if (loadingIndex != '')
    {
        document.images['imageLoad'].src = img[loadingIndex-1];
    }
}

The function is defined. Why am I getting a an error where it says it is not defined?

Edit: Here is the entire file. http://pastebin.com/gu1V5RMd


try onload="loadNext()" instead of onLoad="javascript:loadNext();

P.S.: Make sure your function definition is surrounded by script tag.


Embarrassing. It wasn't inside head tags.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜