Link to home
Start Free TrialLog in
Avatar of dniry
dniry

asked on

Weird JavaScript / IE bug

1) Go to http://www.le-touquet-immobilier.com/en/le_touquet_real_estate.php -> all good.

2) Now, click on any of the menu items (Apartments for example) -> at the bottom of IE in the status bar, you will get a JavaScript error warning ("Object expected" if you look at the details).

3) Now, reload the page -> warning is gone. What the hell?

The error is generated by a JavaScript file which corresponds to the pull-down menu one can see when hovering over the "Our offers" menu item. The weird thing is that this does not happen when testing on my development machine under Windows, but appears on the production site running Linux. Note that this does not prevent the actual menu from working correctly, but it is annoying to see that warning and very weird to see it gone by simply reloading the page...

The JavaScript file in question is actually a '.phpjs' file which gets parsed by PHP to dynamically generate teh appropriate real estate vategories in the pull-down, based on what is in the database. Apache is correctly configured to let PHP parse .phpjs files (AddType application/x-httpd-php .php .php3 .phpjs) and to not apply gzip compression (mod_gzip_item_exclude file \.phpjs$). I have banged my head trying to solve this for hours, without any luck. Any help from someone having had a similar problem is welcome. Below is the code (core JS files are called by this but are part of AllWebMenus standard core files). Many thanks in advance.

<?php
require "../config.inc.php";
session_start();
if (!$_SESSION['file_path']) {
      $_SESSION['file_path']=$cfg['file_path'];
}
require $cfg['pwd_file_path'];
require $cfg['lib_dir_path']."/database/lib_db_connect.inc.php";
require $cfg['lib_dir_path']."/html_elements/dialog/lib_dialog.inc.php";
require $cfg['lib_dir_path']."/html_elements/output/lib_lookup.inc.php";
require $cfg['lib_dir_path']."/application/lib_listmenus_annonces2_en.inc.php";
$cx_prob=p_connect(); if ($cx_prob) { show_msg($cx_prob,"main"); exit; }
$sw_prob=switch_db($cfg['DBName']); if ($sw_prob) { show_msg($sw_prob,"main"); exit; }
?>
//----------DHTML Menu Created using AllWebMenus PRO ver 3.1-#518---------------
awmNS6OffsetY=-31;
var awmMenuName='ASJMenuEN';
var awmLibraryPath='/awmData-ASJMenuEN';
var awmImagesPath='/awmData-ASJMenuEN';
var awmSupported=(navigator.appName + navigator.appVersion.substring(0,1)=="Netscape5" || document.all || document.layers || navigator.userAgent.indexOf('Opera')>-1)?1:0;
if (awmAltUrl!='' && !awmSupported) window.location.replace(awmAltUrl);
if (awmSupported){
var awmMenuPath;
if (document.all) mpi=document.all['awmMenuPathImg-ASJMenuEN'].src;
if (document.layers) mpi=document.images['awmMenuPathImg-ASJMenuEN'].src;
if (navigator.appName + navigator.appVersion.substring(0,1)=="Netscape5" || navigator.userAgent.indexOf('Opera')>-1) mpi=document.getElementById('awmMenuPathImg-ASJMenuEN').src;
awmMenuPath=mpi.substring(0,mpi.length-16);
while (awmMenuPath.search("'")>-1) {awmMenuPath=awmMenuPath.replace("'", "&#39;");}
var nua=navigator.userAgent,scriptNo=(nua.indexOf('Safari')>-1)?7:(nua.indexOf('Gecko')>-1)?2:((document.layers)?3:((nua.indexOf('Opera')>-1)?4:((nua.indexOf('Mac')>-1)?5:((nua.indexOf('Konqueror')>-1)?6:1))));
document.write("<SCRIPT SRC='"+awmMenuPath+awmLibraryPath+"/awmlib"+scriptNo+".js'><\/SCRIPT>");
var n=null;
awmzindex=1000;
}

var awmSubmenusFrame='';
var awmSubmenusFrameOffset;
var awmOptimize=1;
function awmBuildMenu(){
if (awmSupported){
awmImagesColl=['le-touquet-real-estate_r3_c9.gif',75,46,'le-touquet-real-estate_r3_c9_f2.gif',75,46];
awmCreateCSS(1,2,1,'#FFFFFF','#0055E5',n,'14px sans-serif',n,'none',0,n,0,4);
awmCreateCSS(0,1,0,n,'#000000',n,n,n,'outset',0,'#C0C0C0',0,0);
awmCreateCSS(1,2,1,'#000000','#FFFFFF',n,'14px sans-serif',n,'none',1,n,0,1);
awmCreateCSS(0,2,1,'#FFFFFF','#7A96DF',n,'14px sans-serif',n,'none',1,n,0,1);
awmCreateCSS(1,2,1,'#FFFFFF','#0055E5',n,'14px sans-serif',n,'none',2,n,0,0);
awmCreateCSS(0,1,0,n,'#B9CEFF',n,n,n,'outset',1,'#000000',0,0);
awmCreateCSS(1,2,0,'#000000','#B9CEFF',n,'12px Arial',n,'none',0,n,4,1);
awmCreateCSS(0,2,0,'#FFFFFF','#1A1CA1',n,'12px Arial',n,'none',0,n,4,1);
var s0=awmCreateMenu(0,0,0,0,1,0,1,0,0,30,30,0,1,1,0,n,"",n,1,1,0,1,n,n,100);
it=s0.addItemWithImages(2,3,3,"","","","",0,1,1,0,0,0,n,n,n,"",n,n,n,"../en/search.php",n);
var s1=it.addSubmenu(0,0,-20,2,3,0,1,5,4,n,"",n,1,8,1,0,n,n,100);
<?php
$get_cats=mysql_query("select sql_cache distinct annonce_type_bien from annonces order by annonce_type_bien");
while ($cat=mysql_fetch_array($get_cats)) {
      $catnom=lookup_from_array($cat["annonce_type_bien"],$cfg['types_bien']);
      echo "it=s1.addItem(6,7,7,\"&nbsp;&nbsp;".$catnom."s&nbsp;&nbsp;\",n,n,\"\",\"\",n,n,n,\"../en/search.php?cat=".$cat['annonce_type_bien']."\",n);\n";
}
?>
s0.pm.buildMenu();
}}


Avatar of nsanden
nsanden

I go to the home page. Click Apartments tab, let the page load. No javascript warnings or errors (using IE 6). I'm using my office computer though, and apparently didn't have flash installed, so it did make me install that for your '/flash/ocean.swf' file.
ASKER CERTIFIED SOLUTION
Avatar of SnowFlake
SnowFlake
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dniry

ASKER

Hmmm, weird... I am using IE6 as well (build 6.0.2900.2180.xpsp_sp2_gdr.050301-1519) on XP Pro SP2. I tested as well from a Win2K Advanced Server box with IE6 (build 6.0.2800.1106) and am getting it as well (exact JS warning is "Object Expected", line 398). Reload the page, warning is gone.

Works fine on Firefox though.

I'll wait a few more days to see if someone else can help me find the solution. If not, I'll give the points to SnowFlake for providing the link to this very useful JSBugHunter service which I've added to my bookmarks :-)

Many thanks to both of you anyway for taking the time to look at this.

dniry