Hi, Everyone!!

I'm really new in this business and I've been having some trouble with these errors:

======================================================================
Message: Object expected
Line: 1
Char: 1
Code: 0
URI: http://www.myblog.com/successblog/
===================================================================
Message: Expected '}'
Line: 707
Char: 301
Code: 0
URI: http://www.myblog.com/successblog/
==================================================================
Message: Expected '}'
Line: 738
Char: 301
Code: 0
URI: http://www.myblog.com/successblog/
====================================================================
Also after my latest post my blog become a real mess and it keeps telling that:
(1 item remaining) waiting for http://www.myblog.com/successblog/

Can anybody help me with that? I really needs some urgent help

Thanks

If you don't have Firefox, install firefox.
Install the Firebug Addon.

After restarting firefox, load your page again. It should tell you a more helpful description of the problem. If the problem persists, post a link to your page.

Hi, Hielo!!

Thanks for your interest in helping me.
I will do what you said asap.
about the link I can not do that here because violate the policy but you can tell me where else to send it to you.

Please I really need your help

Thanks in advance

You can send it via Private Message here.

Hi, Hielo!!

I have done all what you have been telling but I'm still lost.
How I use Firebug to look for my error?

On the lower right-hand side of Firefox you will see a "bug". Click on it and reload your page.

On another note, I suggest you ALSO install "Web Developer" AddOn:

https://addons.mozilla.org/en-US/firefox/search/?q=HTML+Developer&cat=all&lver=any&pid=1&sort=&pp=20&lup=&advanced=

Once installed, restart firefox. You will see a new bar across the top of the browser. On THAT bar, the last icon on the far-right of the browser window will be red if there are errors.

Thanks Hielo!!

I already did that. Now I'm sending you a private message with the errors and blog Success Blog

On the Web Developer Toolbar there is an icon labeled "Information". Click it and then select "View Javascript".

Click on "Collapse All" then scroll to the last link and expand it. You should see the javascript code that is giving you problems - copy it.

Now open a new tab in Firefox and go to http://jsbeautifier.org/ and paste the code there. Check all the checkboxes and then submit.

At this point it should be clear to you that your php file is creating nested try{}catch() statements but ultimately is NOT closing them.

So, to fix the error you need to examine your php code. It seems that it is dynamically generating javascript from within some loop.

It should NOT be doing that from within a loop since:
a. it keeps sending code to validate the same fields over and over.
b. it is not sending the closing brace for your try (this is what the browser is complaining about).

This is what it should be generating:

try
{
    try
    {
        var pageTracker = _gat._getTracker("UA-8766636-3");
        pageTracker._trackPageview();
    }
    catch (err)
    {
    }
}
catch (e)
{
}

try
{
    var myValidate = new Validate();
    myValidate.addRules(
    {
        id: "da_email",
        option: "required",
        error: "A valid email address is required."
    });

    myValidate.addRules(
    {
        id: "da_email",
        option: "email",
        error: "A valid email address is required."
    });

    myValidate.addRules(
    {
            id: "da_name",
            option: "required",
            error: "A valid name is required."
    });

    myValidate.addRules(
    {
            id: "da_name",
            option: "simpleValidChars",
            error: "A valid name must not contain extra punctuation or special characters."
    });
}
catch(e){}

Hi, Hielo!!

Sorry to bother you so constantly but this problem is driving me crazy.
I have done everything you have told me and more.
I copy/paste into my database the code you send me and although I was capable to identify other errors and fix them, there is one that still persist.

as a matter of fact is the same one but now is switching between 2 file:

1.- autoptimize_d9ef96f648396232a310cb90d9fae8ce.php.none

2.- autoptimize_9706271a8fa878d1d6953ca4d763ae6b.php.none

When I copy/paste the code you send me in one then the error appear in the other and so on.

Could you tell me how am I going to solve this?

Thanks in advance

I copy/paste into my database

I don't know what a database has to do with your problem. The code I pasted was meant for a php file. Like I said, it looks like somewhere in your php code you are creating that javascript in some loop which is NOT producing the right result. I rechecked your url and it is still producing the same output - nested and unbalanced try-catch structures. Without looking at your php code, I cannot help.

Regards,
Hielo

Hi, Hielo!!

I have generated a new java script code following the step you mentioned using Online javascript Beautifier:
==============================================================================

(function ()
{
    var c = window,
        d = document;

    function g(a, b)
    {
        return a.cursor = b
    }
    function h(a, b)
    {
        return a.onmouseover = b
    }
    function i(a, b)
    {
        return a.display = b
    }
    var l = "appendChild",
        m = "length",
        o = "style",
        s;

    function v(a)
    {
        this.O = a.adsContainer;
        this.K = a.nextAdIndex || 0;
        this.z = a.linksContainer;
        this.b = a.previousLink;
        this.a = a.nextLink;
        this.v = a.linkArrowColor;
        this.q = a.linkActiveBgColor;
        this.w = a.linkInactiveBgColor;
        this.G = a.linkActiveCursor;
        this.H = a.linkInactiveCursor;
        this.I = a.loading;
        this.j = a.requestToken;
        this.fa = a.renderAds;
        this.S = a.getNextAdRequestUrl;
        this.ca = a.maxAds;
        this.U = a.handlerUrl;
        this.ha = a.requestUrl;
        this.R = a.formatParams;
        this.d = a.pages;
        this.c = 0;
        this.i = false;
        this.o =
        {
        };
        this.n =
        {
        };
        this.da = a.nextAdsMessage;
        this.ea = a.previousAdsMessage;
        this.f = a.arrowHeight;
        this.g = a.arrowWidth;
        this.l = a.arrowSize;
        this.P = a.arrowGap;
        this.Y = a.isRtl;
        this.X();
        this.ja();
        i(this.z[o], "block")
    }
    s = v.prototype;
    s.ba = function (a)
    {
        this.V();
        if (a.ads[m] == 0)
        {
            this.j = null;
            this.c = 0;
            this.A()
        }
        else
        {
            this.j = a.token && a.token[m] > 0 ? a.token : null;
            for (var b = 0; b < a.ads[m]; ++b)
            {
                a.ads[b].id = this.K;
                ++this.K
            }
            this.Z(a.ads)
        }
        this.p();
        this.i = false
    };
    s.F = function ()
    {
        for (var a = 0; a < this.d[m]; ++a) i(this.d[a][o], "none")
    };
    s.ka = function ()
    {
        this.F();
        i(this.I[o], "")
    };
    s.V = function ()
    {
        i(this.I[o], "none")
    };
    s.B = function (a)
    {
        if (a == 0 && this.c > 0) this.aa();
        else if (a == 1 && (this.j || this.c < this.d[m] - 1)) this.$()
    };
    s.C = function (a)
    {
        i((a == 0 ? this.o : this.n)[2][o], "none");
        this.p()
    };
    s.D = function (a)
    {
        if (a == 0 && this.c > 0 || a == 1 && (this.j || this.c < this.d[m] - 1)) this.ia(a)
    };
    s.Z = function (a)
    {
        var b = this.fa(this.c, a, this.R);
        this.d.push(b);
        this.O[l](b)
    };
    s.$ = function ()
    {
        if (!this.i)
        {
            this.i = true;
            ++this.c;
            if (this.c == this.d[m])
            {
                this.ka();
                this.ga()
            }
            else
            {
                this.A();
                this.p();
                this.i = false
            }
        }
    };
    s.aa = function ()
    {
        if (!this.i)
        {
            this.i = true;
            --this.c;
            this.A();
            this.p();
            this.i = false
        }
    };
    s.A = function ()
    {
        this.F();
        i(this.d[this.c][o], "")
    };
    s.ga = function ()
    {
        var a = this.Q();
        d.getElementsByTagName("head")[0][l](a)
    };
    s.Q = function ()
    {
        var a = this.T(),
            b = d.createElement("script");
        b.setAttribute("src", a);
        return b
    };
    s.s = function (a, b)
    {
        this.u(a);
        i((a == 0 ? this.o : this.n)[b][o], "block")
    };
    s.u = function (a)
    {
        for (var b = a == 0 ? this.o : this.n, f = 0; f <= 2; f++) i(b[f][o], "none")
    };
    s.T = function ()
    {
        return this.S(
        {
            handlerUrl: this.U,
            maxAds: this.ca,
            requestToken: this.j,
            requestUrl: this.ha
        })
    };
    s.ia = function (a)
    {
        if (a == 0) g(this.b[o], this.b.r);
        else g(this.a[o], this.a.r);
        this.s(a, 2)
    };
    s.M = function (a)
    {
        if (a == 0) g(this.b[o], this.b.m);
        else g(this.a[o], this.a.m);
        this.s(a, 1)
    };
    s.L = function (a)
    {
        if (a == 0) g(this.b[o], this.b.m);
        else g(this.a[o], this.a.m);
        this.s(a, 0)
    };
    s.p = function ()
    {
        if (this.c > 0)
        {
            h(this.b, this.b.k);
            this.o[2][o].display == "none" && this.L(0)
        }
        else
        {
            h(this.b, null);
            this.M(0)
        }
        if (this.j || this.c < this.d[m] - 1)
        {
            h(this.a, this.a.k);
            this.n[2][o].display == "none" && this.L(1)
        }
        else
        {
            h(this.a, null);
            this.M(1)
        }
    };
    s.ja = function ()
    {
        this.b.N = this.q;
        this.b.W = this.w;
        this.b.e = this;
        this.b.r = this.G;
        this.b.m = this.H;
        this.b.onmousedown = function ()
        {
            this.e.B(0)
        };
        this.b.k = function ()
        {
            this.e.D(0)
        };
        this.b.onmouseout = function ()
        {
            this.e.C(0)
        };
        h(this.b, this.b.k);
        this.a.N = this.q;
        this.a.W = this.w;
        this.a.e = this;
        this.a.r = this.G;
        this.a.m = this.H;
        this.a.onmousedown = function ()
        {
            this.e.B(1)
        };
        this.a.k = function ()
        {
            this.e.D(1)
        };
        this.a.onmouseout = function ()
        {
            this.e.C(1)
        };
        h(this.a, this.a.k);
        this.p()
    };
    s.h = function (a, b, f, j, p)
    {
        var k = d.createElement("div"),
            e = "position:absolute;overflow:hidden;left:";
        e += a;
        e += "px;top:";
        e += b;
        e += "px;width:";
        e += f;
        e += "px;height:";
        e += j;
        e += "px;";
        e += "background-color:";
        e += p;
        k[o].cssText = e;
        return k
    };
    s.t = function (a, b, f, j)
    {
        var p;
        p = f ? this.h(0, 0, this.g, this.f, a) : this.h(0, 0, this.g, this.f, b);
        var k = this.h(1, 1, this.g - 2, this.f - 2, b);
        p[l](k);
        var e = this.f / 2 - 1,
            q = Math.floor((this.g - 3 - this.l) / 2),
            t, u, r;
        if (j == 0)
        {
            k[l](this.h(q - 1, e - 1, 2, 2, a));
            t = -2;
            u = 0;
            r = -1
        }
        else
        {
            k[l](this.h(q + this.l, e - 1, 2, 2, a));
            t = -this.l - 1;
            u = this.l - 1;
            r = 1
        }
        for (var n = 0; n < this.l; n++)
        {
            k[l](this.h(q + n, e + t + r * n, 2, 2, a));
            k[l](this.h(q + n, e + u - r * n, 2, 2, a))
        }
        return p
    };
    s.J = function (a, b, f)
    {
        var j = false;
        b[1] = this.t(this.v, this.w, j, f);
        a[l](b[1]);
        b[0] = this.t(this.v, this.q, j, f);
        a[l](b[0]);
        j = true;
        b[2] = this.t(this.q, this.v, j, f);
        a[l](b[2])
    };
    s.X = function ()
    {
        var a = 0,
            b = 1;
        if (this.Y)
        {
            a = 1;
            b = 0
        }
        this.J(this.b, this.o, a);
        this.J(this.a, this.n, b);
        this.a.title = this.da;
        this.b.title = this.ea;
        this.z[o].width = 2 * this.g + this.P + "px";
        this.z[o].height = this.f + "px";
        this.b[o].width = this.g + "px";
        this.b[o].height = this.f + "px";
        this.a[o].width = this.g + "px";
        this.a[o].height = this.f + "px";
        this.u(0);
        this.u(1)
    };
    if (!Array.prototype.indexOf) Array.prototype.indexOf = function (a)
    {
        for (var b = 0; b < this[m]; b++) if (this[b] == a) return b;
        return -1
    };
    if (c.sma)
    {
        c.smaSlotManager = new v(c.sma);
        c.handleAdsRequestDone = function (a)
        {
            c.smaSlotManager.ba(a)
        }
    };
})();

=====================================================================================
What should I do now?

Since I have a lot of PHP file for my blog which one is the correct one to place the new code if it is the case?

Thanks for all your help

I have generated a new java script code following the step you mentioned using Online javascript Beautifier:

OK, but the syntax in that code is correct, not sure why you did that. Originally, I identified which javascript code was giving you problems and the point of the beautifier was for YOU to see that there were mismatching try-catch blocks. In other words, the beautified indented the code nicely that it made it easier for you to see the fact that your try-catch blocks were mistmatched AND that your php code was generating multiple instances of the same code in what seemed like a loop. The Beautifier does not detect bad code/synatx. This is something you need to do.

Since I have a lot of PHP file for my blog which one is the correct one to place the new code if it is the case?

We have gone over this. The first step is to identify:
a. What is the error message - Originally you did this via the Web Developer Toolbar(WDT)
b. On which file is this happening - should also be reported by WDT
c. Fix the error on the file where the error is originating from.

Go back to my previous post where I wrote about how to use the WDT if you don't remember.

Hi, Hielo!!

Following your instructions for using Web Developer these are the result:

The last file on Web Developer:
==============================================================================
http://pagead2.googlesyndication.com/pagead/sma8.js
============================================================================

The code when is expanded:
=================================================================================
(function(){
var c=window,d=document;function g(a,b){return a.cursor=b}function h(a,b){return a.onmouseover=b}function i(a,b){return a.display=b}var l="appendChild",m="length",o="style",s;
function v(a){this.O=a.adsContainer;this.K=a.nextAdIndex||0;this.z=a.linksContainer;this.b=a.previousLink;this.a=a.nextLink;this.v=a.linkArrowColor;this.q=a.linkActiveBgColor;this.w=a.linkInactiveBgColor;this.G=a.linkActiveCursor;this.H=a.linkInactiveCursor;this.I=a.loading;this.j=a.requestToken;this.fa=a.renderAds;this.S=a.getNextAdRequestUrl;this.ca=a.maxAds;this.U=a.handlerUrl;this.ha=a.requestUrl;this.R=a.formatParams;this.d=a.pages;this.c=0;this.i=false;this.o={};this.n={};this.da=a.nextAdsMessage;
this.ea=a.previousAdsMessage;this.f=a.arrowHeight;this.g=a.arrowWidth;this.l=a.arrowSize;this.P=a.arrowGap;this.Y=a.isRtl;this.X();this.ja();i(this.z[o],"block")}s=v.prototype;s.ba=function(a){this.V();if(a.ads[m]==0){this.j=null;this.c=0;this.A()}else{this.j=a.token&&a.token[m]>0?a.token:null;for(var b=0;b<a.ads[m];++b){a.ads.id=this.K;++this.K}this.Z(a.ads)}this.p();this.i=false};s.F=function(){for(var a=0;a<this.d[m];++a)i(this.d[a][o],"none")};s.ka=function(){this.F();i(this.I[o],"")};
s.V=function(){i(this.I[o],"none")};s.B=function(a){if(a==0&&this.c>0)this.aa();else if(a==1&&(this.j||this.c<this.d[m]-1))this.$()};s.C=function(a){i((a==0?this.o:this.n)[2][o],"none");this.p()};s.D=function(a){if(a==0&&this.c>0||a==1&&(this.j||this.c<this.d[m]-1))this.ia(a)};s.Z=function(a){var b=this.fa(this.c,a,this.R);this.d.push(b);this.O[l](b)};s.$=function(){if(!this.i){this.i=true;++this.c;if(this.c==this.d[m]){this.ka();this.ga()}else{this.A();this.p();this.i=false}}};
s.aa=function(){if(!this.i){this.i=true;--this.c;this.A();this.p();this.i=false}};s.A=function(){this.F();i(this.d[this.c][o],"")};s.ga=function(){var a=this.Q();d.getElementsByTagName("head")[0][l](a)};s.Q=function(){var a=this.T(),b=d.createElement("script");b.setAttribute("src",a);return b};s.s=function(a,b){this.u(a);i((a==0?this.o:this.n)[o],"block")};s.u=function(a){for(var b=a==0?this.o:this.n,f=0;f<=2;f++)i(b[f][o],"none")};
s.T=function(){return this.S({handlerUrl:this.U,maxAds:this.ca,requestToken:this.j,requestUrl:this.ha})};s.ia=function(a){if(a==0)g(this.b[o],this.b.r);else g(this.a[o],this.a.r);this.s(a,2)};s.M=function(a){if(a==0)g(this.b[o],this.b.m);else g(this.a[o],this.a.m);this.s(a,1)};s.L=function(a){if(a==0)g(this.b[o],this.b.m);else g(this.a[o],this.a.m);this.s(a,0)};
s.p=function(){if(this.c>0){h(this.b,this.b.k);this.o[2][o].display=="none"&&this.L(0)}else{h(this.b,null);this.M(0)}if(this.j||this.c<this.d[m]-1){h(this.a,this.a.k);this.n[2][o].display=="none"&&this.L(1)}else{h(this.a,null);this.M(1)}};
s.ja=function(){this.b.N=this.q;this.b.W=this.w;this.b.e=this;this.b.r=this.G;this.b.m=this.H;this.b.onmousedown=function(){this.e.B(0)};this.b.k=function(){this.e.D(0)};this.b.onmouseout=function(){this.e.C(0)};h(this.b,this.b.k);this.a.N=this.q;this.a.W=this.w;this.a.e=this;this.a.r=this.G;this.a.m=this.H;this.a.onmousedown=function(){this.e.B(1)};this.a.k=function(){this.e.D(1)};this.a.onmouseout=function(){this.e.C(1)};h(this.a,this.a.k);this.p()};
s.h=function(a,b,f,j,p){var k=d.createElement("div"),e="position:absolute;overflow:hidden;left:";e+=a;e+="px;top:";e+=b;e+="px;width:";e+=f;e+="px;height:";e+=j;e+="px;";e+="background-color:";e+=p;k[o].cssText=e;return k};
s.t=function(a,b,f,j){var p;p=f?this.h(0,0,this.g,this.f,a):this.h(0,0,this.g,this.f,b);var k=this.h(1,1,this.g-2,this.f-2,b);p[l](k);var e=this.f/2-1,q=Math.floor((this.g-3-this.l)/2),t,u,r;if(j==0){k[l](this.h(q-1,e-1,2,2,a));t=-2;u=0;r=-1}else{k[l](this.h(q+this.l,e-1,2,2,a));t=-this.l-1;u=this.l-1;r=1}for(var n=0;n<this.l;n++){k[l](this.h(q+n,e+t+r*n,2,2,a));k[l](this.h(q+n,e+u-r*n,2,2,a))}return p};
s.J=function(a,b,f){var j=false;b[1]=this.t(this.v,this.w,j,f);a[l](b[1]);b[0]=this.t(this.v,this.q,j,f);a[l](b[0]);j=true;b[2]=this.t(this.q,this.v,j,f);a[l](b[2])};s.X=function(){var a=0,b=1;if(this.Y){a=1;b=0}this.J(this.b,this.o,a);this.J(this.a,this.n,b);this.a.title=this.da;this.b.title=this.ea;this.z[o].width=2*this.g+this.P+"px";this.z[o].height=this.f+"px";this.b[o].width=this.g+"px";this.b[o].height=this.f+"px";this.a[o].width=this.g+"px";this.a[o].height=this.f+"px";this.u(0);this.u(1)};
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a){for(var b=0;b<this[m];b++)if(this==a)return b;return-1};if(c.sma){c.smaSlotManager=new v(c.sma);c.handleAdsRequestDone=function(a){c.smaSlotManager.ba(a)}};
})();
===================================================================================

The php file with the error
==================================================================================
http://www.myblog/successblog/wp-content/cache/autoptimize/autoptimize_d9ef96f648396232a310cb90d9fae8ce.php
==============================================================================

The error in the php file
====================================================================================

try{try{var pageTracker=_gat._getTracker("UA-8766636-3");pageTracker._trackPageview();}catch(err){}}catch(e){}
try{var myValidate=new Validate();myValidate.addRules({id:"da_email",option:"email",error:"A valid email address is required."});myValidate.addRules({id:"da_email",option:"required",error:"A valid email address is required."});try{myValidate.addRules({id:"da_name",option:"simpleValidChars",error:"A valid name must not contain extra punctuation or special characters."});myValidate.addRules({id:"da_name",option:"required",error:"A valid name is required."});try{var myValidate=new Validate();myValidate.addRules({id:"da_email",option:"email",error:"A valid email address is required."});myValidate.addRules({id:"da_email",option:"required",error:"A valid email address is required."});}catch(e){}
try{myValidate.addRules({id:"da_name",option:"simpleValidChars",error:"A valid name must not contain extra punctuation or special characters."});myValidate.addRules({id:"da_name",option:"required",error:"A valid name is required."});}catch(e){}
try{var myValidate=new Validate();myValidate.addRules({id:"da_email",option:"email",error:"A valid email address is required."});myValidate.addRules({id:"da_email",option:"required",error:"A valid email address is required."});}catch(e){}
try{myValidate.addRules({id:"da_name",option:"simpleValidChars",error:"A valid name must not contain extra punctuation or special characters."});myValidate.addRules({id:"da_name",option:"required",error:"A valid name is required."});}catch(e){}
try{var myValidate=new Validate();myValidate.addRules({id:"da_email",option:"email",error:"A valid email address is required."});myValidate.addRules({id:"da_email",option:"required",error:"A valid email address is required."});}catch(e){}
try{myValidate.addRules({id:"da_name",option:"simpleValidChars",error:"A valid name must not contain extra punctuation or special characters."});myValidate.addRules({id:"da_name",option:"required",error:"A valid name is required."});}catch(e){}

=====================================================================================

Sorry for using the term database I was just trying to say php code instead.
I hope that with this data you can tell me where exactly to go and what should I fix there.

Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.