SCRIPT5007: The value of property is null or undefined

Posted on 2011-05-04
Last Modified: 2013-12-08
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.
Question by:alexcryout
    LVL 13

    Expert Comment

    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

    Author Comment

    Hi Stegium,

    I follow the Microsoft document for IE9 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>
    /* Begin menu Bar classes */
    	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\;
        z-index: 99;
    /* Begin file */
    <PUBLIC:COMPONENT lightWeight="true">
    <PUBLIC:ATTACH event="ondocumentready" handler="InitMenu" />
    <script language="javascript">
    var MenuOpen = false
    function InitMenu()
    	if(typeof(menuBar) != "undefined")
    	{ = "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) = "hidden"
    				var Items = menu.children
    				for(var j=0; j<Items.length; j++)
    					var menuItem = eval(Items[j].id)
    					if( != null)
 = "url(images/arrowrightfill.gif)"
 = "95%"
 = "no-repeat"						
    					if(menuItem.cmd != null) 
    						menuItem.onclick = new Function("Do("")")
    					menuItem.onmouseover = new Function("highlight("+Items[j].id+")")        
    function ShowMenu(obj)
        MenuOpen = true
        var bar = eval(
        if(obj.cmd != null)
    	if( != null)
    	    var menu = eval( = "visible" =  obj.getBoundingClientRect().top + obj.offsetHeight + MainBody.scrollTop - 1
    		if (obj.getBoundingClientRect().left < 10) = obj.getBoundingClientRect().left + MainBody.scrollLeft - 10 
    		else = 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
    		MenuOpen = false
    		window.defaultStatus = ""

    Open in new window


    Author Comment

    Any help?
    LVL 75

    Accepted Solution

    I have never used not seen this syntax used
    MainBody.onmouseover = new Function("BodyMouseOver()")


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

    I would probably use

    MainBody.onmouseover = BodyMouseOver;


    MainBody.onmouseover = function() {


    menuItem.onclick = function() {


    Author Closing Comment

    It works. Thanks

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    #Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now