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']=$cf g['file_pa th'];
}
require $cfg['pwd_file_path'];
require $cfg['lib_dir_path']."/dat abase/lib_ db_connect .inc.php";
require $cfg['lib_dir_path']."/htm l_elements /dialog/li b_dialog.i nc.php";
require $cfg['lib_dir_path']."/htm l_elements /output/li b_lookup.i nc.php";
require $cfg['lib_dir_path']."/app lication/l ib_listmen us_annonce s2_en.inc. php";
$cx_prob=p_connect(); if ($cx_prob) { show_msg($cx_prob,"main"); exit; }
$sw_prob=switch_db($cfg['D BName']); 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-A SJMenuEN';
var awmImagesPath='/awmData-AS JMenuEN';
var awmSupported=(navigator.ap pName + navigator.appVersion.subst ring(0,1)= ="Netscape 5" || document.all || document.layers || navigator.userAgent.indexO f('Opera') >-1)?1:0;
if (awmAltUrl!='' && !awmSupported) window.location.replace(aw mAltUrl);
if (awmSupported){
var awmMenuPath;
if (document.all) mpi=document.all['awmMenuP athImg-ASJ MenuEN'].s rc;
if (document.layers) mpi=document.images['awmMe nuPathImg- ASJMenuEN' ].src;
if (navigator.appName + navigator.appVersion.subst ring(0,1)= ="Netscape 5" || navigator.userAgent.indexO f('Opera') >-1) mpi=document.getElementByI d('awmMenu PathImg-AS JMenuEN'). src;
awmMenuPath=mpi.substring( 0,mpi.leng th-16);
while (awmMenuPath.search("'")>- 1) {awmMenuPath=awmMenuPath.r eplace("'" , "'");}
var nua=navigator.userAgent,sc riptNo=(nu a.indexOf( 'Safari')> -1)?7:(nua .indexOf(' Gecko')>-1 )?2:((docu ment.layer s)?3:((nua .indexOf(' Opera')>-1 )?4:((nua. indexOf('M ac')>-1)?5 :((nua.ind exOf('Konq ueror')>-1 )?6:1))));
document.write("<SCRIPT SRC='"+awmMenuPath+awmLibr aryPath+"/ awmlib"+sc riptNo+".j s'><\/SCRI PT>");
var n=null;
awmzindex=1000;
}
var awmSubmenusFrame='';
var awmSubmenusFrameOffset;
var awmOptimize=1;
function awmBuildMenu(){
if (awmSupported){
awmImagesColl=['le-touquet -real-esta te_r3_c9.g if',75,46, 'le-touque t-real-est ate_r3_c9_ f2.gif',75 ,46];
awmCreateCSS(1,2,1,'#FFFFF F','#0055E 5',n,'14px sans-serif',n,'none',0,n,0 ,4);
awmCreateCSS(0,1,0,n,'#000 000',n,n,n ,'outset', 0,'#C0C0C0 ',0,0);
awmCreateCSS(1,2,1,'#00000 0','#FFFFF F',n,'14px sans-serif',n,'none',1,n,0 ,1);
awmCreateCSS(0,2,1,'#FFFFF F','#7A96D F',n,'14px sans-serif',n,'none',1,n,0 ,1);
awmCreateCSS(1,2,1,'#FFFFF F','#0055E 5',n,'14px sans-serif',n,'none',2,n,0 ,0);
awmCreateCSS(0,1,0,n,'#B9C EFF',n,n,n ,'outset', 1,'#000000 ',0,0);
awmCreateCSS(1,2,0,'#00000 0','#B9CEF F',n,'12px Arial',n,'none',0,n,4,1);
awmCreateCSS(0,2,0,'#FFFFF F','#1A1CA 1',n,'12px Arial',n,'none',0,n,4,1);
var s0=awmCreateMenu(0,0,0,0,1 ,0,1,0,0,3 0,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("sel ect sql_cache distinct annonce_type_bien from annonces order by annonce_type_bien");
while ($cat=mysql_fetch_array($g et_cats)) {
$catnom=lookup_from_array( $cat["anno nce_type_b ien"],$cfg ['types_bi en']);
echo "it=s1.addItem(6,7,7,\"&nb sp; " .$catnom." s &nb sp;\",n,n, \"\",\"\", n,n,n,\".. /en/search .php?cat=" .$cat['ann once_type_ bien']."\" ,n);\n";
}
?>
s0.pm.buildMenu();
}}
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']=$cf
}
require $cfg['pwd_file_path'];
require $cfg['lib_dir_path']."/dat
require $cfg['lib_dir_path']."/htm
require $cfg['lib_dir_path']."/htm
require $cfg['lib_dir_path']."/app
$cx_prob=p_connect(); if ($cx_prob) { show_msg($cx_prob,"main");
$sw_prob=switch_db($cfg['D
?>
//----------DHTML Menu Created using AllWebMenus PRO ver 3.1-#518---------------
awmNS6OffsetY=-31;
var awmMenuName='ASJMenuEN';
var awmLibraryPath='/awmData-A
var awmImagesPath='/awmData-AS
var awmSupported=(navigator.ap
if (awmAltUrl!='' && !awmSupported) window.location.replace(aw
if (awmSupported){
var awmMenuPath;
if (document.all) mpi=document.all['awmMenuP
if (document.layers) mpi=document.images['awmMe
if (navigator.appName + navigator.appVersion.subst
awmMenuPath=mpi.substring(
while (awmMenuPath.search("'")>-
var nua=navigator.userAgent,sc
document.write("<SCRIPT SRC='"+awmMenuPath+awmLibr
var n=null;
awmzindex=1000;
}
var awmSubmenusFrame='';
var awmSubmenusFrameOffset;
var awmOptimize=1;
function awmBuildMenu(){
if (awmSupported){
awmImagesColl=['le-touquet
awmCreateCSS(1,2,1,'#FFFFF
awmCreateCSS(0,1,0,n,'#000
awmCreateCSS(1,2,1,'#00000
awmCreateCSS(0,2,1,'#FFFFF
awmCreateCSS(1,2,1,'#FFFFF
awmCreateCSS(0,1,0,n,'#B9C
awmCreateCSS(1,2,0,'#00000
awmCreateCSS(0,2,0,'#FFFFF
var s0=awmCreateMenu(0,0,0,0,1
it=s0.addItemWithImages(2,
var s1=it.addSubmenu(0,0,-20,2
<?php
$get_cats=mysql_query("sel
while ($cat=mysql_fetch_array($g
$catnom=lookup_from_array(
echo "it=s1.addItem(6,7,7,\"&nb
}
?>
s0.pm.buildMenu();
}}
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmmm, weird... I am using IE6 as well (build 6.0.2900.2180.xpsp_sp2_gdr .050301-15 19) 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
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