SCRIPT5007: The value of property is null or undefined

Dear Expert:

My website works well on any previous IE version but on IE9 all Menu item doesn't work and get error "SCRIPT5007: The value of property 'BodyMouseOver' is null or undefined". I am using HTC & JavaScript.
Please help.
alexcryoutAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
I have never used not seen this syntax used
MainBody.onmouseover = new Function("BodyMouseOver()")

and

menuItem.onclick = new Function("Do("+menuItem.id+")")

I would probably use

MainBody.onmouseover = BodyMouseOver;

or

MainBody.onmouseover = function() {
  BodyMouseOver();
}

and

menuItem.onclick = function() {
  Do(this.id)
}

0
 
stergiumCommented:
hello alexcryout

It would help alot if you posted some of the code that is causing the problem.
you can try add a meta tag like this one.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

please feedback
0
 
alexcryoutAuthor Commented:
Hi Stegium,

I follow the Microsoft document for IE9 http://support.microsoft.com/kb/956197#4 and enable Compatibility View for my whole website.
      X-UA-Compatible: IE=EmulateIE7

Codes attached. Thanks

<asp:panel id="menuPanel" runat="server">
	<DIV class="menuBar" id="menuBar">
		<DIV class="menuBarItem" style="width: 70px;" id="menuBarHome" title="Goto Home Page" cmd="Home.aspx">Home</DIV>
		<DIV class="menuBarItem" style="width: 70px;" id="menuBarSetup" cmd="Setup.aspx" menu="SetupMenu">Setup</DIV>
		<DIV class="menuBarItem" style="width: 100px;" id="menuBarProgram" cmd="Program.aspx" menu="ProgrammingMenu">Program</DIV>
		<DIV class="menuBarItem" style="width: 95px;" id="menuBarHelp" title="Help Center" cmd="javascript:PopUpHelp()" menu="HelpMenu">Help</DIV>
		<DIV class="menuBarItem" style="width: 85px;" id="menuBarLogout" title="Log off" cmd="Logout.aspx">Logout</DIV>
	</DIV>	
</asp:panel>

/* Begin menu Bar classes */
.menuBar
{
	font-family: Arial, Verdana, Helvetica, sans-serif;
    font-size: 10pt;
    font-weight: bold;
    position: absolute;
    top: 82;
    left: 10px;
    width: 780px;
    height: 25px;
    background-color: transparent;
    text-align: center;
    visibility: hidden;
    behavior: url(Script\Menu.htc);
    z-index: 99;
}

/* Begin Menu.htc file */
<PUBLIC:COMPONENT lightWeight="true">
<PUBLIC:ATTACH event="ondocumentready" handler="InitMenu" />

<script language="javascript">

var MenuOpen = false

function InitMenu()
{
	if(typeof(menuBar) != "undefined")
	{
		menuBar.style.visibility = "visible"

		var bar = menuBar.children
		
		MainBody.onmouseover = new Function("BodyMouseOver()")
		for(var i=0;i < bar.length;i++) 
		{
			bar[i].onmouseover = new Function("ShowMenu("+bar[i].id+")")
			
			if(bar[i].cmd != null)
			{
				bar[i].onclick = new Function("Do("+bar[i].id+")")
			}	
			
			if(bar[i].menu != null)
			{
				var menu=eval(bar[i].menu)
				menu.style.visibility = "hidden"
				var Items = menu.children
				for(var j=0; j<Items.length; j++)
				{
					var menuItem = eval(Items[j].id)
		            
					if(menuItem.menu != null)
					{ 
						menuItem.style.backgroundImage = "url(images/arrowrightfill.gif)"
						menuItem.style.backgroundPosition = "95%"
						menuItem.style.backgroundRepeat = "no-repeat"						
						FindSubMenu(menuItem.menu)
					}
					if(menuItem.cmd != null) 
					{
						menuItem.onclick = new Function("Do("+menuItem.id+")")
					} 
							
					menuItem.onmouseover = new Function("highlight("+Items[j].id+")")        
				}
			}
		}  
	
	}
}

function ShowMenu(obj)
{
	HideMenu(menuBar)
    MenuOpen = true
    var bar = eval(obj.id)
    if(obj.cmd != null)
    {
		bar.className="menuBarOverCmd"
	}
	else
	{
		bar.className="menuBarOver"
	}
	if(obj.menu != null)
	{
	    var menu = eval(obj.menu)
		menu.style.visibility = "visible"
		menu.style.pixelTop =  obj.getBoundingClientRect().top + obj.offsetHeight + MainBody.scrollTop - 1
		if (obj.getBoundingClientRect().left < 10) 
			menu.style.pixelLeft = obj.getBoundingClientRect().left + MainBody.scrollLeft - 10 
		else
			menu.style.pixelLeft = obj.getBoundingClientRect().left + MainBody.scrollLeft - 10 
		
	}
	
	if(obj.title != null)
		window.defaultStatus = obj.title
}

function BodyMouseOver()
{
	if (MenuOpen = false) return

	if (window.event.srcElement != null)
	{
		var cl = window.event.srcElement.className
		
		if (cl == "menuBar") return
		if (cl == "menuBarItem") return
		if (cl == "menuWnd") return
		if (cl == "menuRight") return
		if (cl == "menuSubItem") return
		if (cl == "menuSubItemChild") return
		if (cl == "menuItemMouseOver") return
		if (cl == "menuItemMouseOverChild") return
		if (cl == "menuItemMouseOverRight") return
		if (cl == "menuSubItemRight") return
		if (cl == "menuBarOver") return
		if (cl == "menuBarOverCmd") return
		if (cl == "menuArrow") return

		HideMenu(menuBar)
		MenuOpen = false
		window.defaultStatus = ""
	}
}

</script>
</PUBLIC:COMPONENT>

Open in new window

0
 
alexcryoutAuthor Commented:
Any help?
0
 
alexcryoutAuthor Commented:
It works. Thanks
0
All Courses

From novice to tech pro — start learning today.