mama_rock 0 Newbie Poster

i have make my own system. the system is about application for a leave using online. the problem is, when i using Internet Explorer8 the submenu cannot be click. there is the coding that i have attach with.


(admin_phpddm.php)

print "<!-- PHP Drop Down Menu 0.4 by Stefano SteO Arcidiacono (ww.steo.it/php) -->\n";

class phpddm_menu {
     function phpddm_menu($title, $vtitle, $width, $url, $target) {
        $this->TITLE = $title;
		$this->VTITLE = $vtitle;
		$this->WIDTH = $width;
		$this->URL = $url;
		$this->TARGET = $target;
    }
}

class phpddm_submenu {
     function phpddm_submenu($title, $url, $target) {
        $this->TITLE = $title;
		$this->URL = $url;
		$this->TARGET = $target;
    }
}

require('admin_phpddm.inc.php');

// Browser check 3.0
  unset($browser);
  $browser = 'ns'; // Default browser
  if (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'opera')) $browser = 'op';   
  elseif (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie 6')) $browser = 'ie6'; 
  elseif (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie')) $browser = 'ie'; 
  elseif (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'mozilla')) $browser = 'ns'; 
  if (stristr($_SERVER['HTTP_USER_AGENT'], 'Gecko/200') && (!(stristr($HTTP_USER_AGENT, 'compatible')))) $browser = 'ns6';

$Maxmenu = count($PHPDDM_menu) - 1;
$sum = 0;

for ($i=0; $i <= $Maxmenu; $i++ ) 
	{
	$PHPDDM_width[$i] = $PHPDDM_menu[$i]->WIDTH;
    $PHPDDM_pos[$i] = $sum; 
	$sum = $sum + $PHPDDM_width[$i];
	}

function vtitle($str) 
	{
	$return = '';
	for ($i=0; $i <= strlen($str); $i++) $return.= substr($str, $i, 1).'<br>'; 
	return $return;
	}

########################## Create main menu

unset($str);
$str = '';

if ($browser == 'op') $visibility = ''; else $visibility = 'visibility:hidden;';

$str.= '<div id="phpddmMenu" style="position:absolute; width:100%; top:'.$PHPDDM['top'].'; left:0;'.$visibility.'"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr bgcolor="'.$PHPDDM['mcolor'].'">'; 

for ($i=0; $i <= $Maxmenu; $i++ ) 
	if ($browser == 'ns')  
		$str.= '<td width="'.$PHPDDM_width[$i].'" align="left"><ILAYER><LAYER width="'.$PHPDDM_width[$i].'" onmouseover="showMenu(\''.$i.'\'); bgColor='.$phpddm_mover.'" onmouseout="bgColor=\''.$PHPDDM['mcolor'].'\'"><a href="'.$PHPDDM_menu[$i]->URL.'" target="'.$PHPDDM_menu[$i]->TARGET.'"><span class="MENU">'.$PHPDDM_menu[$i]->TITLE.'</span></a></LAYER></ILAYER></td>';
	else  
		$str.= '<td bgcolor="'.$PHPDDM['mcolor'].'" width="'.$PHPDDM_width[$i].'" onmouseover="bgColor=\''.$PHPDDM['mover'].'\'; showMenu('.$i.')" onmouseout="bgColor=\''.$PHPDDM['mcolor'].'\'" align="left"><a href="'.$PHPDDM_menu[$i]->URL.'" target="'.$PHPDDM_menu[$i]->TARGET.'"><span class="MENU">'.$PHPDDM_menu[$i]->TITLE.'</span></a></td>'; 
		
if ($browser == 'ns') 
	$str.= "<td width=\"100%\">&nbsp;</td></tr></table></div>\n";  
else 
	$str.= "<td>&nbsp;</td></tr></table></div>\n";
	
print $str; 


######################## Create Submenu
// IE and NS version
$str = '';

for ($i=0; $i <= $Maxmenu; $i++) 
	{
	if (empty($PHPDDM_submenu[$i])) 
		$str.= '<div id="subMenu'.$i.'" style="position:absolute; width:0; height:0; top:0; left:0; visibility:hidden; z-index:99;"></div>';
	else 
		{
		$str.= '<div id="subMenu'.$i.'" style="position:absolute; left:'.$PHPDDM_pos[$i].'; top:'.$PHPDDM['subtop'].'; width:'.$PHPDDM['width'].';  background-color:black;layer-background-color:black; visibility:hidden; z-index:99;"';

		if ($browser == 'ns') 
			{
			$str.= '><table width="'.$PHPDDM['width'].'" border="0" cellspacing="0" cellpadding="0">';
			$str.= '<tr><td valign="top">';
			$str.= '<table bgcolor="'.$PHPDDM['lcolor'].'" border="0" width="100%" cellspacing="1" cellpadding="1">';
			} 
		elseif ($browser == 'ie6')  
			{
			$str.= 'onmouseout="hideMenu()"><table width="'.$PHPDDM['width'].'" border="0" cellspacing="0" cellpadding="0" onmouseover="showMenu('.$i.')">';
			$str.= '<tr><td width="15" bgcolor="#C0C0C0" align="center" valign="top" style="padding:0,0,0,0;border-color:black;border-style:solid; border-right:0;border-width:1"><span class="VMENU">'.vtitle($PHPDDM_menu[$i]->VTITLE).'</span></td><td valign="top">'; 
			$str.= '<table bgcolor="'.$PHPDDM['lcolor'].'" border="0" width="100%" cellspacing="1" cellpadding="1" onmouseover="showMenu('.$i.')">';
			}
		else
			{
			$str.= '><table width="'.$PHPDDM['width'].'" border="0" cellspacing="0" cellpadding="0">';
			$str.= '<tr><td width="15" bgcolor="#C0C0C0" align="center" valign="top" style="padding:0,0,0,0;border-color:black;border-style:solid; border-right:0;border-width:1"><span class="VMENU">'.vtitle($PHPDDM_menu[$i]->VTITLE).'</span></td><td valign="top">'; 
			$str.= '<table bgcolor="'.$PHPDDM['lcolor'].'" border="0" width="100%" cellspacing="1" cellpadding="1">';
			}
	
		for ($k=0; $k < count($PHPDDM_submenu[$i]); $k++) 
		  if ($browser == 'ns')  
			$str.= '<tr><td bgcolor="'.$PHPDDM['scolor'].'"><ILAYER><LAYER width="100%" onmouseover="bgColor=\''.$PHPDDM['sover'].'\'" onmouseout="bgColor=\''.$PHPDDM['scolor'].'\'"><a href="'.$PHPDDM_submenu[$i][$k]->URL.'" target="'.$PHPDDM_submenu[$i][$k]->TARGET.'" class="SUBMENU">'.$PHPDDM_submenu[$i][$k]->TITLE.'</a></LAYER></ILAYER></td></tr>'; 
		  elseif ($browser == 'ie6')   
			$str.= '<tr ><td bgcolor="'.$PHPDDM['scolor'].'" onmouseover="bgColor=\''.$PHPDDM['sover'].'\'" onmouseout="bgColor=\''.$PHPDDM['scolor'].'\'"><a href="'.$PHPDDM_submenu[$i][$k]->URL.'" target="'.$PHPDDM_submenu[$i][$k]->TARGET.'" class="SUBMENU" onmouseover="showMenu('.$i.')">'.$PHPDDM_submenu[$i][$k]->TITLE.'</a></td></tr>';
		  else 
			$str.= '<tr><td bgcolor="'.$PHPDDM['scolor'].'" onmouseover="bgColor=\''.$PHPDDM['sover'].'\'" onmouseout="bgColor=\''.$PHPDDM['scolor'].'\'"><a href="'.$PHPDDM_submenu[$i][$k]->URL.'" target="'.$PHPDDM_submenu[$i][$k]->TARGET.'" class="SUBMENU">'.$PHPDDM_submenu[$i][$k]->TITLE.'</a></td></tr>';
				
		$str.= "</table></td></tr></table></div>\n";
		}
	}

print $str; 

############################ Javascript #############################
?>
<script language="JavaScript">

var sub_top = <?=$PHPDDM['top']?>;
var x = 0; var y = 0; 
var x1 = 0; var y1 = 0; 
var x2 = 0; var y2 = 0; 
var sel = 0; var temp;

<?
//######################## OPERA
if ($browser == 'op') 
	{
	for ($i=0; $i <= $Maxmenu; $i++) 
		{
		 print "document.all['subMenu$i'].onmouseover=handlerMM;";
		 print "document.all['subMenu$i'].onmouseout=handlerMM;";
		}
?>

function handlerMM(e) {
	if(!e)e=window.event;
	if(e.type=="mouseover")mouse=true;
	else{ mouse=false; setTimeout("hideMenu()",100) }
   }

function showMenu(x) {
	eval('document.all["subMenu'+sel+'"].style.visibility="hidden"');
	sel = x;
	eval('document.all["subMenu'+sel+'"].style.visibility="visible"');
   }

function hideMenu() {
	if(!mouse){	eval('document.all["subMenu'+sel+'"].style.visibility="hidden"');}
   }
<? 
//######################## Internet Explorer	
} elseif($browser == 'ie') {?>
	
	   
function handlerMM(e) {
	x = event.clientX;
	y = event.clientY;
	temp = 'subMenu' + sel;	

	x1 = document.all[temp].style.posLeft; 
	x2 = x1 + document.all[temp].offsetWidth;
	y1 = document.all[temp].style.posTop;
	y2 = y1 + document.all[temp].offsetHeight;	

	if ((x <= x1) || (x >= x2) || (y >= y2))  { eval('document.all["subMenu'+sel+'"].style.visibility="hidden"') }
   }

function showMenu(x){
	eval('document.all["subMenu'+sel+'"].style.visibility="hidden"');
	sel = x;
	eval('document.all["subMenu'+sel+'"].style.visibility="visible"');
   }
   
document.onmousemove = handlerMM 
eval('document.all["phpddmMenu"].style.visibility="visible"');
<? 
//######################## Netscape Navigator	
} elseif($browser == 'ns') {?>
			   
function handlerMM(e) {
	x = e.pageX 
	y = e.pageY
	temp = 'subMenu' + sel;	

	x1  = document.layers[temp].left;
	x2 = x1 + document.layers[temp].clip.width;
	y1  = document.layers[temp].top;
	y2 = y1 + document.layers[temp].clip.height;		
	
	if ((x <= x1) || (x >= x2) || (y >= y2))  { eval('document.layers["subMenu'+sel+'"].visibility="hidden"') }
}

function showMenu(x) {
	eval('document.layers["subMenu'+sel+'"].visibility="hidden"');
	sel = x;
	eval('document.layers["subMenu'+sel+'"].visibility="visible"');
   }

document.captureEvents(Event.MOUSEMOVE);   
document.onmousemove = handlerMM 
eval('document.layers["phpddmMenu"].visibility="visible"');
<? 
//######################## Netscape Navigator	
} elseif($browser == 'ns6') {?>
		   
function handlerMM(e) {
	if (e.type=="mouseover") { 	mHide=false; } else { mHide=true; setTimeout("hideMenu()",1000) }
}

function hideMenu() {
	if (mHide == true) {
		menu = "subMenu" + sel;
		document.getElementById(menu).style.visibility = "hidden";	
		}
	}

function showMenu(x) {
	menu = "subMenu" + sel;
	document.getElementById(menu).style.visibility = "hidden";
	sel = x;
	menu = "subMenu" + sel;
	document.getElementById(menu).style.visibility = "visible";
   }
 
<? 
	$str = '';

	for ($i=0; $i <= $Maxmenu; $i++) 
		{
		 $str.= "document.getElementById(\"subMenu$i\").addEventListener(\"mouseout\", handlerMM, false);\n";
		 $str.= "document.getElementById(\"subMenu$i\").addEventListener(\"mouseover\", handlerMM, false);\n";
		}
	$str.= "document.getElementById(\"phpddmMenu\").style.visibility = \"visible\";\n";
	print $str;
	
//######################## INTERNET EXPLORER DOM
} elseif($browser == 'ie6') {?>

sel=1;

function showMenu(x){
	eval('document.all["subMenu'+sel+'"].style.visibility="hidden"');
	sel = x;
	eval('document.all["subMenu'+sel+'"].style.visibility="visible"');
	window.event.cancelBubble=true
   }

function hideMenu(){
		eval('document.all["subMenu'+sel+'"].style.visibility="hidden"');
		window.event.cancelBubble=true
   }

eval('document.all["phpddmMenu"].style.visibility="visible"');

<? } 
?>
</script>




[B](admin_phpddm.inc.php)[/B]
# menu distance from top
	$PHPDDM['top'] = 0;
# submenu distance from top
	$PHPDDM['subtop'] = 20;
# submenu width
	$PHPDDM['width'] = 160;
# menu color
	$PHPDDM['mcolor'] = '#D9E3F0';
# menu over color
	$PHPDDM['mover'] = '#D6D6D6';
# submenu background color
	$PHPDDM['scolor'] = '#D9E3F0';
# submenu over color
	$PHPDDM['sover'] = '#CCCCCC';
# submenu background layer color (== submenu borders)
	$PHPDDM['lcolor'] = '#FFFFFF';



# phpddm_menu(TITLE, VTITLE, WIDTH, URL, TARGET)
#
# phpddm_submenu(TITLE, URL, TARGET)

$PHPDDM_menu[0] = new phpddm_menu('Menu', '', 65, 'main_menu.php', '');

$PHPDDM_menu[1] = new phpddm_menu('Home', '', 70, 'admin_welcomepage.php', '');

$PHPDDM_menu[2] = new phpddm_menu('Yearly', '',70, '#', '');
$PHPDDM_submenu[2][0] = new phpddm_submenu('Annual Leave', 'display_annual_leave.php', '');
$PHPDDM_submenu[2][1] = new phpddm_submenu('Medical Leave', 'display_medical_leave_setup.php', '');
$PHPDDM_submenu[2][2] = new phpddm_submenu('Study Leave', 'display_study_leave.php', '');
$PHPDDM_submenu[2][3] = new phpddm_submenu('Compassionate Leave', 'display_compassionate_leave.php', '');
$PHPDDM_submenu[2][4] = new phpddm_submenu('Marriage Leave', 'display_marriage_leave.php', '');
$PHPDDM_submenu[2][5] = new phpddm_submenu('Maternity Leave', 'display_maternity_leave.php', '');
$PHPDDM_submenu[2][6] = new phpddm_submenu('Paternity Leave', 'display_paternity_leave.php', '');
$PHPDDM_submenu[2][7] = new phpddm_submenu('Replacement Leave', 'display_replacement_leave_setup.php', '');
$PHPDDM_submenu[2][8] = new phpddm_submenu('No Pay Leave', 'display_nopaid_leave.php', '');
$PHPDDM_submenu[2][9] = new phpddm_submenu('Carryforward Probation Leave', 'CFPL_leave_setup.php', '');

$PHPDDM_menu[3] = new phpddm_menu('Quarterly', '', 90, 'display_quarterly.php', '');

$PHPDDM_menu[4] = new phpddm_menu('Carry Forward', '', 118, 'display_carryforward.php', '');

$PHPDDM_menu[5] = new phpddm_menu('Data Setup', '', 90, '#', '');
$PHPDDM_submenu[5][0] = new phpddm_submenu('Leave Portion', 'display_leave_portion.php', '');
$PHPDDM_submenu[5][1] = new phpddm_submenu('Company Setup', 'display_company_details.php', '');
$PHPDDM_submenu[5][2] = new phpddm_submenu('Position Setup', 'position_display.php', '');
$PHPDDM_submenu[5][3] = new phpddm_submenu('Employee Setup', 'display_new_employee_setup.php', '');
$PHPDDM_submenu[5][4] = new phpddm_submenu('Panel Clinic', 'display_panel_clinic_setup.php', '');

$PHPDDM_menu[6] = new phpddm_menu('Public Holiday','', 118, 'display_public_holiday_setup.php', '');

$PHPDDM_menu[7] = new phpddm_menu('Leave Selection ','', 123, 'display_admin_choose_leave.php', '');

$PHPDDM_menu[8] = new phpddm_menu('Announcement','', 122, 'display_admin_announcement_setup.php', '');

$PHPDDM_menu[9] = new phpddm_menu('Document Tracking','', 142, '#', '');
$PHPDDM_submenu[9][0] = new phpddm_submenu('Employee', 'dt_chjEmployee.php', '');
$PHPDDM_submenu[9][1] = new phpddm_submenu('Leave Application Summary', 'dt_leaveApplicationSummary.php', '');
$PHPDDM_submenu[9][2] = new phpddm_submenu('Leave Selection', 'dt_leaveSelection.php', '');
$PHPDDM_submenu[9][3] = new phpddm_submenu('Company', 'dt_companyInfo.php', '');
$PHPDDM_submenu[9][4] = new phpddm_submenu('Panel Clinic', 'dt_panelClinicInfo.php', '');
$PHPDDM_submenu[9][5] = new phpddm_submenu('Public Holiday', 'dt_publicHols.php', '');
$PHPDDM_submenu[9][6] = new phpddm_submenu('Position', 'dt_position.php', '');
$PHPDDM_submenu[9][7] = new phpddm_submenu('Announcement', 'dt_announcement.php', '');
$PHPDDM_submenu[9][8] = new phpddm_submenu('Terms and Conditions', 'dt_terms_and_conditions.php', '');
?>

which part is wrong? i still can figure out.