Hi, I got javascript error: unknown exception in IE 6

Take a look:

http://buildalook.com/index.php?l=Measure
login: test2
password: test2

Click "other information" in the left, first it's work good. But when I refresh and click "other information" again, I got javascript error: unknown exception.

Can you help me?

Excluding the use of bugFixing tools-- you can simply remove all <script></script> blocks inside your page and bring them back one by one, test the page then refresh your browser.

If you find the block, simply post it back here again for help...

You have used so many tables in your HTML. I can only suggest you to re-check your HTML code. May be some <td> <tr> </td> </tr> tags are missing.

Here is the error in line 242

eval(begining+"setHtml('"+response[response.length-1]+"out','"+html+"');"+end);

This is only happened in IE 6, in firefox no error.

Yes, take a look the attachment

Attachments
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url(images/pb.jpg);
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META NAME="description" CONTENT="Impeccable quality at an accessible price

Buildalook.com offers customized men's and women's apparel including suits, shirts, pants, and blazers made by our expert tailors utilizing luxury fabrics.">
<title>Build A Look: Custom Clothiers - Measure</title>
<script>
  function init(){}
  function getID(id){
    var obj = null;
    if(document.getElementById){
      /* Prefer the widely supported W3C DOM method, if available */
      obj = document.getElementById(id);
    }else if(document.all){
      /* Branch to use document.all on document.all only browsers. Requires that IDs are unique to the page
         and do not coincide with NAME attributes on other elements 
      */
      obj = document.all[id];
    }else throw("Can Not Get Element By Id")
    //alert(obj);
    /* If no appropriate element retrieval mechanism exists on
      this browser this function always returns null
    */
    return obj;
  }
  function createXMLHttpRequest() {
    if (typeof XMLHttpRequest != "undefined") {
      return new XMLHttpRequest();
    } else if (typeof ActiveXObject != "undefined") {
      return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
      throw new Error("XMLHttpRequest not supported");
    }
  }
</script>
<meta name="keywords" content="suits, custom suits, custom tailor, tailor, bangkok tailor thailand, custom shirts, men's suits, made to measure, custom tailors, custom suit, bespoke suit, bespoke tailor, bespoke tailoring" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color:white;
}
-->
</style>
<link href="buildalook_stylesheet.css" rel="stylesheet" type="text/css" />
<!--stmenu is a neccessary file for the dhtml -->
<script type="text/javascript" src="stmenu.js"></script>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="init();MM_preloadImages('images/swatch_over.jpg')">
<table width="859" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000033" class="maintable_attributes">
  <tr>
    <td align="left" valign="top"><table width="859" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top"><table width="859" border="0" cellpadding="0" cellspacing="0" background="images/headerbg.jpg">
          <tr>
            <td align="left" valign="top"><table width="859" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" valign="top"><img src="images/buildalook_logo.jpg" alt="buildalook" width="432" height="96" /></td>
                <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top"><img src="images/vspacer.gif" alt="spacer" width="4" height="8" /></td>
                    <td align="left" valign="top"><img src="images/vspacer.gif" alt="spacer" width="422" height="8" /></td>
                  </tr>
                  <tr>
                    <td align="left" valign="top"><img src="images/vspacer.gif" alt="spacer" width="4" height="34" /></td>
                    <td align="left" valign="top">
                    <!--Account Table Start -->
                      <table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td align="right" class="whitesmall"><a href="?l=My_Account">My Account</a> | <a href="?p=cart.php">Checkout</a> | <a href="?p=logout.php">Logout</a></td><td width="10" align="right" class="whitesmall">&nbsp;</td></tr></table>                    <!--Account Table End -->
                    </td>
                  </tr>
                  <tr>
                    <td align="left" valign="top"><img src="images/navspace.jpg" alt="spacer" width="4" height="54" /></td>
                    <td align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="navigation">
                      <tr>
                      <!--DHTML MENU Start -->
                        <td align="left" valign="top"><script type="text/javascript" language="JavaScript1.2" src="buildalook_dhtml.js"></script></td>
                      <!--DHTML MENU End -->
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><img src="images/divider.jpg" alt="divider" width="859" height="19" /></td>
          </tr>
        </table></td>
      </tr>
      <tr style='height:480px;font-size: 12px;font-family: Arial, Helvetica, sans-serif;'>
        <td align="left" valign="top" style='color:white'>
            <style type='text/css'>
    input.nice{
      width:17px;
    }
  </style>
  <script type='text/javascript'>
    var storage;
    function rackchange(i,val){
      var req=createXMLHttpRequest();
      getID(i+'hide2').style.backgroundColor="black";
      req.open("GET", "ajax/Measurements/submitMeasurements.php?m="+i+"&v="+val+"&r=true&mins=" + new Date().getTime(), true);
      req.onreadystatechange=function(){
        if(req.readyState == 4 && req.status == 200) {
          response=req.responseText.split(',');
          if(response[1]=='1'){
            getID(response[0]+'hide2').style.backgroundColor="green";
          }else if(response[1]=='2'){
            getID(response[0]+'hide2').style.backgroundColor="#5F79A0";
          }else{
            getID(response[0]+'hide2').style.backgroundColor="red";
          }
        }
      }
      req.send(null);
    }
    function measchange(i,val){
      var req=createXMLHttpRequest();
      getID(i+'img').src="ajax/Measurements/32-0.gif";
      getID(i+'img').width='23';
      req.open("GET", "ajax/Measurements/submitMeasurements.php?m="+i+"&v="+val+"&mins=" + new Date().getTime(), true);
      req.onreadystatechange=function(){
        if(req.readyState == 4 && req.status == 200) {
          checkComplete();
          response=req.responseText.split(',');
          if(response[1]=='1'){
            getID(response[0]+'img').src="images/measurements/check.jpg";
          }else if(response[1]=='2'){
            getID(response[0]+'img').src="images/measurements/dash.jpg";
          }else{
            getID(response[0]+'img').src="images/measurements/err.jpg";
          }
        }
      }
      req.send(null);
    }
    function resetTop(){
      getID('midpic').src="images/measurements/start.jpg";
      if(getID('1out').style.display!='none'){getID('1out').style.display='none';getID('1out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}if(getID('2out').style.display!='none'){getID('2out').style.display='none';getID('2out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}if(getID('3out').style.display!='none'){getID('3out').style.display='none';getID('3out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}if(getID('4out').style.display!='none'){getID('4out').style.display='none';getID('4out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}if(getID('-1out').style.display!='none'){getID('-1out').style.display='none';getID('-1out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}if(getID('-2out').style.display!='none'){getID('-2out').style.display='none';getID('-2out').innerHTML='<img src="ajax/Measurements/32-0.gif">';}    }
    function setHtml(i,html){
      getID(i).innerHTML=html;
    }
    function openTop(i){
      test=(getID(i+'out').style.display=='none'?true:false);
      resetTop();
      if(test){
        if (document.all){
          getID(i+'out').style.display='inline';
        }else{
          getID(i+'out').style.display='table-cell';
        }
        getID(i+'out').innerHTML='<img src="ajax/Measurements/32-0.gif">';
        var req=createXMLHttpRequest();
        req.open("GET", "ajax/Measurements/measurement_grabber.php?p="+i+"&mins=" + new Date().getTime(), true);
        req.onreadystatechange=function(){
          image=[];
          if(req.readyState == 4 && req.status == 200) {
            var response=req.responseText.split('~');
            html='<table>';
            begining='';
            end='';
            inside='';
            for(i=0;i<(response.length-1);i++){
              response[i]=response[i].split('`');
              inside+=response[i][0]+',';
            }
            window.storage=response;
            for(i=0;i<(response.length-1);i++){
              if(response[i][3]!='Select' && response[i][3]!='No Img') begining+='var image'+i+' = new Image();image'+i+'.onload=function(){';

Hi gakki,

Sorry, but I am unable to access (or download) your file' via WAP connect, that's why i am asking for direct path in your domain so i could just view the whole block from there.

This is the only source i get VIEW SOURCE still aint gettin those lines.

- My computer went down, so i am just using a palm device to answer thread's visibly posted here.

Don't worry i'm sure someone here will provide you extra help asside from me...

Try to fix this line:

Old lines:

if(response[i][3]!='Select' && response [i][3]!='No Img') end='};image'+i+'.src = "DB/measure/'+response[i][0]+'.jpg";'+end;

Convert the Old lines into this format:

if ( response[ i ][ 3 ] !== 'Select' && response[ i ][ 3 ] !== 'No Img' ) 
end= '};'
begining += 'image' + i + '.src = "DB/measure/' + response[ i ][ 0 ] + '.jpg";' + end;

Run some test and let me know how it worked.

This the openTop() function reference, and i've fixed some of the lines.

The only problem is i don't know where stop on each of these statement inside the function having it done on a small screen.

Just un-comment the part where it needs to be executed.

function() {  
   response = req.responseText.split("~");
   html = "<table>";
   begining = "";
   end = "";
   inside = ""; 
      for ( k = 0; k < ( response.length - 1 ); k++ ) { 
// replace the i incrementor with k, since you are using it as an arguments in other function.
      response[ k ] = response[ k ].split("`");

      inside += response[ k ][ 0 ];
      } // window.storage = response;
      for ( k = 0; k < ( response.length - 1 ); k++ ) {
         /* if (( response[ k ][ 3 ] !== "Select" ) && ( response[ k ][ 3 ] !== "No Img" )) { */
         begining += "var image" + k + " = new Image();";
         begining += "image" + k + ".onload = function() {";
         /* } */
         /* if (( response[ k ][ 3 ] !== "Select" ) && ( response[ k ][ 3 ] !== "No Img" )) { */
         end = "}; image" + k + ".src = \"DB/measure/" + response[ k ][ 0 ] + ".jpg\"" + end;
         /* } */
html += "<tr>\n";
      html += "<td style=\"text-align : left\" onmouseover=\"openInside( '" + response[ k ][ 0 ] + "', ";
         /* if (( response[ k ][ 3 ] !== "Select" ) && ( response[ k ][ 3 ] !== "No Img" )) { */
         html += "'DB/measure/" + response[ k ][ 0 ] + ".jpg'";
         /* } else { */
         html += "''";
         /* } */
         html += ", '" + inside + "' )\"><img src=\"";
         /* if( response[ k ][ 4 ] === "" ) { */ 
         html += "/images/measurements/dash.jpg";
         /* } else { */
         html += "/images/measurements/check.jpg";
         /* } */ 
         html += "\" id=\"" + response[ k ][ 0 ] + "img\"></td>\n<td style=\"text-align : left;\" onmouseover=\"openInside( '" + response[ k ][ 0 ] + "', ";
         /* if (( response[ k ][ 3 ] !== "Select" ) && ( response[ k ][ 3 ] !== "No Img" )) { */
         html += "'DB/measure/" + response[ k ][ 0 ] + ".jpg'";
         /* } else { */
         html += "''";
         /* } */
      html += ", '" + inside + "' );\">" + response[ k ][ 1 ] + "</td></tr>\n";
         /* if( response[ k ][ 3 ] === "Select" ) */
         html += "<tr id=\"" + response[ k ][ 0 ] + "hide1\"  style=\"display : none;\"><td>&nbsp;</td><td style=\"text-align : left; width : 100%;\"><table id=\"" + response[ k ][ 0 ] + "sl\" style=\"cursor : pointer; background-color : white; color : black; width:100%;\" cellspacing=\"0px\">\n";
         items = response[ k ][ 5 ].split("}"); 
         for ( j = 0; j < ( items.length - 1 ); j++ ) {
         items[ j ] = items[ j ].split("{"); 
         html += "<tr><td id=\"" + response[ k ][ 0 ] + "" + items[ j ][ 0 ] + "opt\" ";
            /* if ( response[ i ][ 4 ] === items[ j ][ 0 ] ) { */
            html += "style=\"background-color:blue;color : white;\"";
            /* } */ 
         html += "onclick=\"selectOption( '" + response[ k ][ 0 ] + "', '" + items[ j ][ 0 ] + "');\" onmouseover=\"changeOption( '" + response[ k ][ 0 ] + "', '" + items[ j ][ 0 ] + "'";
            /* if ( items[ j ][2] === 0 ) { */ 
            html += ",false";
            /* } */
            html += ");\">" + items[ j ][ 1 ] + "</td><tr>";
            /* if ( items[ j ][ 2 ] === 1 ) { */ 
            begining += "var image" + k + "o" + j + " = new Image(); image" + k + "o" + j + ".onload = function() {";
             /* if ( items[ j ][ 2 ] === 1 ) { */
              end = "}; image" + k + "o" + j + ".src = \"DB/measure/select/" + items[ j ][ 0 ] + ".jpg\";" + end;
            /* } */
           html += "</table></td></tr>";
          /* } else { // Confusing part: Try to base this block in your code and see which part of line  should take the end bracket. */
          html += "<tr id=\"" +response[ k ][ 0 ] + "hide1\" style=\"display : none\"><td>&nbsp;</td><td style=\"text-align:left\"><input type=\"text\" maxlength=\"3\" style=\"width:25px\" onkeyup=\"measchange(" + response[ k ][ 0 ] + ", this.value );\" value=\"" +response[ k ][ 4 ] + "\">"  + response[ k ][ 2 ] + "</td></tr>";
            if ( response[ k ][ 3 ] === "Rack" ) { 
            html += "<tr id=\"" + response[ k ][ 0 ] + "hide2\" style=\"display:none\"><td>&nbsp;</td><td style=\"text-align:right\">Optional: off the rack size: <input type=\"text\" maxlength=\"3\" style=\"width:25px\" onkeyup=\"rackchange(" +response[ k ][ 0 ] + ", this.value );\" value=\"" + response[ k ][ 5 ] + "\"></td></tr>";
            } else {
            html += "<tr id=\"" + response[ k ][ 0 ] + "hide2\" style=\"display:none\"></tr>";
            }
      /* } */        
      } /* END BLOCK: For statement with j incrementor */
   } /* END BLOCK: For statement with k incrementor */
      html += "</table>";
      eval( begining + "setHtml('" + response [response.length-1] + "out', '" + html + "' );" + end );
 
}; /* EXIT Function */
This article has been dead for over six months. Start a new discussion instead.