Javascript,未捕获引用错误:未定义函数()

Javascript,未捕获引用错误:未定义函数(),javascript,api,rest,twitter,photobucket,Javascript,Api,Rest,Twitter,Photobucket,嗯,我似乎不明白为什么我的函数不是在单击或加载时定义的 我通过firebug运行了它,没有看到任何语法错误。任何帮助都将不胜感激 小提琴: 有关守则: function getAlbums(user, album) { var url = "http://api.photobucket.com/album/"; url = url + encodeURIComponent( user + "/" + album ) var json =

嗯,我似乎不明白为什么我的函数不是在单击或加载时定义的

我通过firebug运行了它,没有看到任何语法错误。任何帮助都将不胜感激

小提琴:

有关守则:

    function getAlbums(user, album) {
        var url = "http://api.photobucket.com/album/";

        url = url + encodeURIComponent( user + "/" + album )
        var json = callPhotobucket( url, "format=json" );

    }

    function getTag(media) {
    var url = "http://api.photobucket.com/media/";

    url = url + encodeURIComponent(media) + "/tag" ;
    var json = callPhotobucket(url, "format=json");
    }

    function getTimestamp() {
        var timestamp = new Date().valueOf();
        timestamp = timestamp / 1000;
        timestamp = Math.ceil( timestamp );
        return timestamp;
    }

    function ping() {
    auth_url = callPhotobucket( "http://api.photobucket.com/ping", "format=json" );
    }

    function callPhotobucket( url, format ) {
        try {
            if( url == undefined ) {
            url = "http://api.photobucket.com/ping";
            }

            if( format == undefined ) {
                format = "format=json";
            }

        var timestamp = getTimestamp();
        auth_nonce="nonce" + timestamp;

        auth_method = "HMAC-SHA1";
        auth_timestamp = "" + timestamp;

        auth_version="1.0";

        auth_consumer = "&oauth_consumer_key="+ encodeURIComponent( consumer_key );
        nonce = "&oauth_nonce="+ encodeURIComponent( auth_nonce );
        auth_sig_method = "&oauth_signature_method="+ encodeURIComponent( auth_method );
        auth_timestamp = "&oauth_timestamp="+ encodeURIComponent( auth_timestamp );
        version = "&oauth_version=" + encodeURIComponent( auth_version );

        paramstring = format + auth_consumer + nonce + auth_sig_method + auth_timestamp + version;

        method = "GET";

        base = encodeURIComponent( method ) + "&" + encodeURIComponent( url ) + "&" + encodeURIComponent( paramstring );

        sig_hash = getSignature( consumer_secret+"&", base );
        auth_sign = "&oauth_signature=" + sig_hash;

        auth_url = url + "?" + paramstring + "&" + auth_sign;
        myalert( ""+ auth_url+"");
        return auth_url;

        }

        catch (err) {
        alert( "Error " + err );
        }
    }

    function getSignature(key, baseString) {
        b64pad = '=';
        var signature = b64_hmac_sha1(key, baseString);
        return signature;
    }

问题在于我包含的sha1实现。经过多次测试(逐行测试),当移除include时,它起到了作用


谢谢

把小提琴换成nowrap。另外,在html文件.Cyan中包含您的javascript,谢谢您的回复。我将javascript包含在html文件中,在fiddle中,我还添加了假的consumer_密钥和consumer_机密。sha错误是因为我没有将其包括在小提琴中。我仍然得到ping和getAlbum未定义。