tags:

views:

311

answers:

3

if you open the page: http://www.rhino.com/shop/product/the-monkees-the-birds-the-bees-the-monkees-boxed-set you will see at the bottom of the page, a next and previous buttons, these are navigation buttons, they work fine in firefox but in ie the style is removed from the page when they are clicked!. please advise on what might be the cause of the problem. i have already spent hours debugging :(

A: 

In IE8, by the time the page had fully loaded, the error symbol disappeared :-)

IrishChieftain
A: 

You have a javascript error elsewhere in the page that is causing your AJAX call to fail. Rather than load the contents from a page like:

http://www.rhino.com/community/proxy/review/pt/reviews%7E8a0af81225b9499b0125fbdb296d04f5/ptq/eNortjKzUipITE-1NVSyBlwwGvQDqA

It is actually opening the page. Look at the address bar and you will see what I am talking about.

This is the error I get from IE.

Webpage error details

Message: Object doesn't support this property or method
Line: 38
Char: 2
Code: 0
URI: http://www.rhino.com/js/analytics/s_code.js
sberry2A
+1  A: 

When I debug it on IE8, I see a runtime error here:

cd=new Date();

Most likely this does not accord with this piece of HTML:

<li id="cd" class=""><a href="#productInfo-cd">CD</a></li>

IE 'helpfully' launches elements with an id as global variables. So cd is actually a <li> element, and IE doesn't like it if you assign new Date() to it. It would be perfectly fine if IE would treat cd as a normal local variable, but it does not, hence the runtime error.

This piece of code is inside a anonymous function which is really nasty (shown below). But the solution is simple: just write proper functions, and declare your variables. If the anonymous function would have used one line in the top declaring variables like this:

var cd, dc, ...other variable names... ;

it would have worked just fine, because then the cd variable inside the function would have referred to the local variable, not the global cd element which IE thinks referes to the li element with id="cd".

Now it is entirely possible that this is just one of many problems with this page. But I am assuming the first error encountered by IE stopped execution of the remainder of your script, which why some of it diddn't work.

function anonymous(t, z, y) {
  dc=new Date('1/1/2000');f=15;ne=8;
  if(dc.getDay()!=6||dc.getMonth()!=0){
    return'Data Not Available'
  }else{;
    z=parseInt(z);
    if(y=='2009'){f=8;ne=1};
    gmar=new Date('3/1/'+y);
    dsts=f-gmar.getDay();
    gnov=new Date('11/1/'+y);
    dste=ne-gnov.getDay();
    spr=new Date('3/'+dsts+'/'+y);
    fl=new Date('11/'+dste+'/'+y);
    cd=new Date();
    if(cd>spr&&cd<fl){
      z=z+1
    }else{
      z=z
    };
    utc=cd.getTime()+(cd.getTimezoneOffset()*60000);
    tz=new Date(utc + (3600000*z));
    thisy=tz.getFullYear();
    var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
    if(thisy!=y){
       return'Data Not Available'
    }else{;
       thish=tz.getHours();
       thismin=tz.getMinutes();
       thisd=tz.getDay();
       var dow=days[thisd];var ap='AM';var dt='Weekday';
       var mint='00';
       if(thismin>30){mint='30'}
       if(thish>=12){ap='PM';thish=thish-12};
       if (thish==0){thish=12};
       if(thisd==6||thisd==0){dt='Weekend'};
       var timestring=thish+':'+mint+ap;
       var daystring=dow;
        var endstring=dt;
       if(t=='h'){
          return timestring}
       if(t=='d'){
           return daystring};if(t=='w'){return endstring}}};
   }

Now debugging where this is comming from is a bit of a prob. My callstack reads:

anonymous   JScript
s_doPlugins JScript
    anonymous function  JScript
global code JScript

The top one is where the actual error occurs.

The root where this is all happening is here:

    /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
    var s_code=s.t();if(s_code)document.write(s_code)

Somehow, from here, s_doPlugins is called which contains the actual call to the anonymous function that is causing the trouble. It looks like s_doPlugins is located in s_code.js. If I step through that, I find that the trouble is in this line:

s.prop9=s.getTimeParting('h','-5','2008'); // Set hour 

which is line 38 of s_code.js. With a little bit more poking around, I find it is actuall this plugin:

/*
* Plugin: getTimeParting 1.3 - Set timeparting values based on time zone
*/
s.getTimeParting=new Function("t","z","y",""
+"dc=new Date('1/1/2000');f=15;ne=8;if(dc.getDay()!=6||"
...more crap here...

This is at line 95 in s_code.js

As a quick fix i would probably comment out all calls to s.getTimeParting() in s_doPlugins() in s_code.js and see if that fixes your problem. Then, the long and hard but noble taks remains of churning something sensible out of this mess :))

Roland Bouman
thanks for your information, but where can i locate this anonymous method, in which page?
Microgen
@Microgen, this code is a rat's nest. But I'll make an effort. I'm updating my answer shortly:
Roland Bouman
thanks a lot, please let me know what do i have to change to fix this
Microgen
Microgen: I updated my answer, way below is a tip to find if this is actually the problem. Be warned though that there may well be lots and lots more of these errors. Basically this is javascript from hell.
Roland Bouman
it is js from hell indeed! i will try to fix this and will let you what happens.thanks
Microgen