Friday, February 27, 2015

Embarassing Moment

I rewrote my ScopeRoller web page a year or two ago to calculate the pricing for various regions of the world, in Javascript, so it would automatically produce one-click buttons for all the various variations of each product by region.  But suddenly it has stopped producing those buttons.  I should be able to figure out what went wrong; butt the brain isn't what it used to be.  Are you a Javascript whiz?  Interested in making a little money figuring out what went wrong?  View the source at http://www.scoperoller.com/ScopeRoller93493.shtml, and try and tell me why produceByVariantRegion function stopped working?

These are the days that I HATE Javascript.

.
ScopeRollerVHAL.shtml:124 Uncaught ReferenceError: Invalid left-hand side in assignment
  1. ScopeRollerVHAL.shtml:680 Uncaught ReferenceError: regions is not defined
  1. ScopeRollerVHAL.shtml:618 Uncaught ReferenceError: VHALStdUS is not defined
 http://www.scoperoller.com/ScopeRollerVHAL.shtml

There is something showing up in Chrome that isn't in the source I am uploading for prices.shtml:

// ScopeRollers: ATSPP
ATSATSPPDeluxe5=170;

is actually:

 // ScopeRollers: ATSPP
ATSPPDeluxe=150;
ATSPPDeluxe5=170;

Something is scrambling this.

I added this to prices.shtml:

// ScopeRollers: CAVX

//CAVXStd=120;
//CAVXDeluxe=150;
//CAVXDeluxe5=170;
//USDelivery=12.35;
//CanadaDelivery=40.95;
//EuropeDelivery=59.95;
//CAVXStdUS=(CAVXStd+USDelivery)*1.03;
//CAVXStdCanada=(CAVXStd+CanadaDelivery)*1.03;
//CAVXStdEurope=(CAVXStd+EuropeDelivery)*1.03;
//CAVXDeluxeUS=(CAVXDeluxe+USDelivery)*1.03;
//CAVXDeluxeCanada=(CAVXDeluxe+CanadaDelivery)*1.03;
//CAVXDeluxeEurope=(CAVXDeluxe+EuropeDelivery)*1.03;
//CAVXDeluxe5US=(CAVXDeluxe5+USDelivery)*1.03;
//CAVXDeluxe5Canada=(CAVXDeluxe5+CanadaDelivery)*1.03;
//CAVXDeluxe5Europe=(CAVXDeluxe5+EuropeDelivery)*1.03;
but without the comments, of course.

Thanks to all.  First trick of successful web page programming: make sure WS_FTP is pointing at the directory you think it is!

8 comments:

  1. Hey Clayton,

    I just opened up the dev tools in Chrome and these are the errors I see. That should get you started.

    Line 119: Uncaught SyntaxError: Unexpected token <
    Line 791: ScopeRoller93493.shtml:791 Uncaught ReferenceError: regions is not defined
    Line 730: ScopeRoller93493.shtml:730 Uncaught ReferenceError: C93493StdUS is not defined

    ReplyDelete
  2. Line 119 had an errant script tag in the middle of the javascript, which caused the rest to halt evaluation.

    I remove that line and it works, but it looks like you've made some further changes since posting this.

    ReplyDelete
  3. You had an errant script tag in the middle of the javascript at line 119, causing the rest to halt evaluation.

    Removing that line worked for me, but it looks like you have made further changes since posting this.

    ReplyDelete
  4. Clayton,

    You had an errant script tag on line 119 in the middle of the javascript. Simply removing this tag worked for me.

    Since trying that on my PC it looks like you have made further changes. Now line 124 has an extra < in the middle of the variable name.

    ReplyDelete
  5. Yup, but not in the source I am ftping up.

    ReplyDelete
  6. It helps to be ftping from the right directort. Thyanks all for your help.

    ReplyDelete
  7. I saw the errant script tag as well. I left a comment about it, but I guess it got eaten by the ether. I did put it in tag format, so I bet the Google ate it. That may have been the only problem.

    ReplyDelete