what happens if you put an empty else {} after the last elseif?

On Jun 19, 10:33 am, bombaru <bomb...@gmail.com> wrote:
> I think it's the "if/else if" statement at the top.  If I change the
> last "else if" to just an "else", I get a syntax error but no
> unresponsive script error.
>
> function mousedownSearchTracking(e) {
>         var $zone = $(this);
>
>         if (typeof (e.data.action) == "undefined") {
>             if (typeof (CreateOnClickEvent) != "undefined")
>                 CreateOnClickEvent('Search', 30, searchHandler +
> e.data.section);   // just section data
>         }
>         else if (e.data.action == "link") {
>             var linkText = $zone.text();
>             if (typeof (CreateOnClickEvent) != "undefined")
>                 CreateOnClickEvent('Search', 30, searchHandler +
> e.data.section + ':' + linkText);   // with link data
>         }
>         else if (e.data.action == "position") {
>             var position = $zone.attr('position');
>             if (typeof (CreateOnClickEvent) != "undefined")
>                 CreateOnClickEvent('Search', 30, searchHandler +
> e.data.section + ':' + position);   // add position data
>         }
>
>         $zone.unbind('mousedown');
>
>     }
>
> On Jun 19, 10:17 am, bombaru <bomb...@gmail.com> wrote:
>
> > I've pinpointed the script that's causing the timeout.  Commenting
> > this script out resolves the issue.  I don't see anything in this
> > script however that is out of place.  I'd be curious if some better
> > trained eyes find something.
>
> > Thanks again for all of your help.
>
> > ======================================//
>
> > jQuery(document).ready(function($) {
>
> >     var searchHandler = 'MoneySearch';
>
> >     function mousedownSearchTracking(e) {
> >         var $zone = $(this);
>
> >         if (typeof (e.data.action) == "undefined") {
> >             if (typeof (CreateOnClickEvent) != "undefined")
> >                 CreateOnClickEvent('Search', 30, searchHandler +
> > e.data.section)   // just section data
> >         }
> >         else if (e.data.action == "link") {
> >             var linkText = $zone.text();
> >             if (typeof (CreateOnClickEvent) != "undefined")
> >                 CreateOnClickEvent('Search', 30, searchHandler +
> > e.data.section + ':' + linkText)   // with link data
> >         }
> >         else if (e.data.action == "position") {
> >             var position = $zone.attr('position');
> >             if (typeof (CreateOnClickEvent) != "undefined")
> >                 CreateOnClickEvent('Search', 30, searchHandler +
> > e.data.section + ':' + position)   // add position data
> >         }
>
> >         $zone.unbind('mousedown');
>
> >     }
>
> >     /// Handle the Search box submit on the Search page
> >     function submitSearchTracking(e) {
> >         var $zone = $(this);
> >         var inputValue = $('input[id=prod-search]').val();  // get the
> > search value the user typed in
>
> >         if (typeof (CreateOnClickEvent) != "undefined")
> >             CreateOnClickEvent('Search', 30, searchHandler +
> > e.data.section)   // just section data
>
> >         $zone.unbind('submit');
> >     }
>
> >     // Click Events to bind
> >     // -----------------------------------------------
> >     // re-search
> >     $('form[id=searchform]').bind('submit', { section: ":re-search" },
> > submitSearchTracking);
>
> >     // Did You Mean
> >     $('div.did-you-mean a').bind('mousedown', { section:
> > ":DidYouMean" }, mousedownSearchTracking);
>
> >     // Category filters
> >     $("li[trackcat='Category'] ul li").not($("li.toggle")).each
> > (function(counter) {
> >         var thiscounter = counter + 1;
> >         $("li[trackcat='Category'] ul li:nth-child(" + thiscounter +
> > ") a").bind('mousedown', { section: ":Category" + thiscounter },
> > mousedownSearchTracking);
> >     });
>
> >     // Brand filters
> >     $("li[trackcat='Brand'] ul li").not($("li.toggle")).each(function
> > (counter) {
> >         var thiscounter = counter + 1;
> >         $("li[trackcat='Brand'] ul li:nth-child(" + thiscounter + ")
> > a").bind('mousedown', { section: ":Brand" + thiscounter },
> > mousedownSearchTracking);
> >     });
>
> >     // Price range filters
> >     $("li[trackcat='Price Range'] ul li a").each(function(counter) {
> >         $(this).bind('mousedown', { section: ":PriceRange" },
> > mousedownSearchTracking);
> >     });
>
> >     // Customer rating filters
> >     $("li[trackcat='Customer Rating'] ul li a").each(function(counter)
> > {
> >         searchHandler = 'MoneySearchB';
>
> >         var inputValue = $(this).text();
> >         if (inputValue.search("5 stars") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRating5Stars" }, mousedownSearchTracking);
> >         else if (inputValue.search("4 stars") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRating4Stars" }, mousedownSearchTracking);
> >         else if (inputValue.search("3 stars") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRating3Stars" }, mousedownSearchTracking);
> >         else if (inputValue.search("2 stars") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRating2Stars" }, mousedownSearchTracking);
> >         else if (inputValue.search("1 star") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRating1Star" }, mousedownSearchTracking);
> >         else if (inputValue.search("Not Yet Rated") > -1)
> >             $(this).bind('mousedown', { section:
> > ":CustomerRatingNotYetRated" }, mousedownSearchTracking);
> >     });
>
> >     // The 'more' buttons to expand long filters
> >     $("li[trackcat='Category'] li.toggle a").bind('mousedown',
> > { section: ":CategoryMore" }, mousedownSearchTracking);
> >     $("li[trackcat='Brand'] li.toggle a").bind('mousedown', { section:
> > ":BrandMore" }, mousedownSearchTracking);
>
> >     // Learn tab content
> >     $("ul[trackcat='learntabcontent'] li").each(function(counter) {
> >         var thiscounter = counter + 1;
> >         $("ul[trackcat='learntabcontent'] li:nth-child(" + thiscounter
> > + ") a").bind('mousedown', { section: ":Article" + thiscounter },
> > mousedownSearchTracking);
> >     });
>
> >     // Support content
> >     $("ul[trackcat='supportcontent'] li").each(function(counter) {
> >         var thiscounter = counter + 1;
> >         $("ul[trackcat='supportcontent'] li:nth-child(" + thiscounter
> > + ") a").bind('mousedown', { section: ":Support" + thiscounter },
> > mousedownSearchTracking);
> >     });
>
> >     // Community content
> >     $("ul[trackcat='communitycontent'] li").each(function(counter) {
> >         var thiscounter = counter + 1;
> >         $("ul[trackcat='communitycontent'] li:nth-child(" +
> > thiscounter + ") a").bind('mousedown', { section: ":Community" +
> > thiscounter }, mousedownSearchTracking);
> >     });
>
> >     // Sort strip links
> >     $("div.r-sort-strip-top a.showall").bind('mousedown', { section:
> > ":SortStripShowAll" }, mousedownSearchTracking);
> >     $("div.r-sort-strip a.r-sort-prev").bind('mousedown', { section:
> > ":SortStripPrevPage" }, mousedownSearchTracking);
> >     $("div.r-sort-strip a.r-sort-next").bind('mousedown', { section:
> > ":SortStripNextPage" }, mousedownSearchTracking);
> >     $("div.r-sort-strip-top a[trackcat='switchtopaged']").bind
> > ('mousedown', { section: ":SortStripSwitchToPaged" },
> > mousedownSearchTracking);
> >     $("div.r-sort-strip a[trackcat='pagelink']").each(function() {
> >         var inputValue = $(this).text();
> >         $(this).bind('mousedown', { section: ":SortStripResults" +
> > inputValue }, mousedownSearchTracking);
> >     });
>
> >     // product block links
> >     $("div[id='maincolumn'] div.productList-block-container").each
> > (function(counter) {
> >         var thiscounter = counter + 1;
> >         // product link
> >         $(this).find("a.pg-img").bind('mousedown', { section:
> > ":Product" + thiscounter }, mousedownSearchTracking);
> >         $(this).find("div.productList-desc a").bind('mousedown',
> > { section: ":Product" + thiscounter }, mousedownSearchTracking);
> >         // add to cart
> >         $(this).find("div.productList-action a").bind('mousedown',
> > { section: ":Product" + thiscounter + "AddToCart" },
> > mousedownSearchTracking);
> >         // reviews
> >         $(this).find("div.star-rating a").bind('mousedown', { section:
> > ":Product" + thiscounter + "Reviews" }, mousedownSearchTracking);
> >         // outlet
> >         $(this).find("a[trackcat='Outlet']").bind('mousedown',
> > { section: ":Product" + thiscounter + "Outlet" },
> > mousedownSearchTracking);
> >         // scratch and dent
> >         $(this).find("a[trackcat='Scratch & Dent']").bind('mousedown',
> > { section: ":Product" + thiscounter + "ScratchAndDent" },
> > mousedownSearchTracking);
> >     });
>
> > });
>
> > On Jun 18, 7:54 pm, ferdjuan <afr...@gmail.com> wrote:
>
> > > That error has nothing to do with jQuery-1.3.2.js, it's one of your
> > > scripts. You're missing a semi-colon or have some unclosed quotes, or
> > > you're trying to use a function that doesn't exist. Are you using
> > > Firefox with the Firebug plugin to debug? If not, do it, it should
> > > give you a more detailed description of the error in your script. I've
> > > seen this error a million times, and it's always one of those things I
> > > listed before.

Reply via email to