View Full Version : 'divclass' is null or not an object in Internet Explorer

08-03-2009, 09:30 AM
1) AnyLink JS Drop Down Menu

2) http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Internet Explorer returns error 'divclass' is null or not an object in file anylinkmenu.js on line 248 and 249 which r bold.

part of anylinkmenu.js

setupmenu:function(targetclass, anchorobj, pos){
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
var relattr=anchorobj.getAttribute("rel")
dropmenuid=relattr.replace(/\[(\w+)\]/, '')
var dropmenuvar=window[dropmenuid]
var dropmenu=this.addDiv(null, dropmenuvar.divclass, dropmenuvar.inlinestyle) //create and add main sub menu DIV
var menu=this.menusmap[targetclass+pos]={
id: targetclass+pos,
anchorobj: anchorobj,
dropmenu: dropmenu,
revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click")? "click" : "mouseover",
orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",
shadow: this.addDiv(null, "anylinkshadow", null) //create and add corresponding shadow

Please help

08-03-2009, 09:49 PM
Does this happen on the DD demo page, or just on your own. If the later, please post a link to it.

08-05-2009, 03:58 PM
issue with my site only and not demo page. have no clue as to what am doing differently as i havent changed .js files. page is at www.vastech.co.ug/memd/annual.php no links are active. error appears in left corner of status bar. all files can be accessed from http://www.vastech.co.ug/memd/menucontents.js replacing menucontents.js with file to view,names still defaults. please help,kinda desperate here

08-06-2009, 06:43 PM
There are a few obvious errors with your menu anchor links:

<table cellspacing="0" cellpadding="0" bgcolor="#818b9d"><tr><td ce>
<a href="index.php" lass="menuanchorclass" rel="anylinkmenu4" rev="lr" data-image="images/home1.gif" data-overimage="images/home2.gif"><img src="images/home1.gif" style="border-width:0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu1" rev="lr" data-image="images/about1.gif" data-overimage="images/about2.gif"><img src="images/about1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu2" rev="lr" data-image="images/pol1.gif" data-overimage="images/pol2.gif"><img src="images/pol1.gif" width="150" height="29" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu3" rev="lr" data-image="images/proj1.gif" data-overimage="images/proj2.gif"><img src="images/proj1.gif" border="0" /></a><br>

<a href="" class="menuanchorclass" rel="anylinkmenu4" rev="lr" data-image="images/pub1.gif" data-overimage="images/pub2.gif"><img src="images/pub1.gif" border="0" /></a><br>

<a href="" class="menuanchorclass" rel="anylinkmenu5" rev="lr" data-image="images/faq1.gif" data-overimage="images/faq2.gif"><img src="images/faq1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu6" rev="lr" data-image="images/links1.gif" data-overimage="images/links2.gif"><img src="images/links1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu7" rev="lr" data-image="images/what1.gif" data-overimage="images/what2.gif"><img src="images/what1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu8" rev="lr" data-image="images/media1.gif" data-overimage="images/media2.gif"><img src="images/media1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu9" rev="lr" data-image="images/album1.gif" data-overimage="images/album2.gif"><img src="images/album1.gif" border="0" /></a><br>
<a href="" class="menuanchorclass" rel="anylinkmenu10" rev="lr" data-image="images/opps1.gif" data-overimage="images/opps2.gif"> <img src="images/opps1.gif" width="120" height="30" border="0" /></a><br>
<a href="contacts.php" class="menuanchorclass" data-image="images/contact1.gif" data-overimage="images/contact2.gif"><img src="images/contact1.gif" border="0" /></a><br>


I've highlighted the errors in red. Firstly, in your first link, "lass" should be "class". You should probably just remove that link, as it appears to be redundant. Moving along, with your last link, it's missing a rel attribute pointing to the desired sub menu, which is required.

08-07-2009, 06:37 AM
thanks. working fine now in internet explorer. Corrected errors in red and is all good. Appreciate the help big time.

09-30-2009, 06:04 PM
Damn i hate IE! lol

Im using IE8 and im having the same problem... I've checked the html and the js and its all OK...

IE keep saying: 'divclass' is null or not an object."

Heres the link:
(the dropdown comes on SOBRE in the menu.)

HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="site.css" type="text/css" media="screen" />
<link href="scroll.css" rel="stylesheet" type="text/css" />
<link href="scrollstyles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scroll.js"></script>
<script type="text/javascript" src="load.js"</script>
<link rel="stylesheet" type="text/css" href="drop/anylinkmenu.css" />
<script type="text/javascript" src="drop/menucontents.js" charset="ISO-8859-1"></script>
<script type="text/javascript" src="drop/anylinkmenu.js" charset="ISO-8859-1">

* AnyLink JS Drop Down Menu v2.0- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code

<script type="text/javascript">

//anylinkmenu.init("menu_anchors_class") //Pass in the CSS class of anchor links (that contain a sub menu)

<div id="menu" align="center"><img src="menu/logo.jpg" width="258" height="137" /><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','menu/home2.jpg',1)"><img src="menu/home.jpg" alt="home" name="home" width="75" height="137" border="0" id="home" /></a><img src="menu/div.jpg" width="9" height="137" />
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('sobre','','menu/sobre2.jpg',1)" class="menuanchorclass" rel="anylinkmenu4">
<img src="menu/sobre.jpg" alt="sobre" name="sobre" width="73" height="137" border="0" id="sobre" /></a><img src="menu/div.jpg" width="9" height="137" /><a href="servicos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('servicos','','menu/servicos2.jpg',1)"><img src="menu/servicos.jpg" alt="serviços" name="servicos" width="98" height="137" border="0" id="servicos" /></a><img src="menu/div.jpg" width="9" height="137" /><a href="parceiros.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('parceiros','','menu/parceiros2.jpg',1)"><img src="menu/parceiros.jpg" alt="parceiros" name="parceiros" width="109" height="137" border="0" id="parceiros" /></a><img src="menu/div.jpg" width="9" height="137" /><a href="contato.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contato','','menu/contato2.jpg',1)"><img src="menu/contato.jpg" alt="contato" name="contato" width="112" height="137" border="0" id="contato" /></a></div>

the .js files:

How to fix that? Its possible to fix this issue in ie8???

Thanks guys!

09-30-2009, 09:07 PM
Hmm at a glance I don't see any issues except for the following code in the HEAD section of your page:

<script type="text/javascript" src="load.js"</script>

It's missing a closing ">" tag following "load.js".

10-19-2009, 12:56 PM
I closed the tag, but the problem persists.
I dont understand, its all ok but the menu just dont work on IE!

Did you guys can sugest another cool and simple dropdown menu that works well on IE 6+???

Thanks for the help!

11-11-2009, 07:56 PM
Apologies if this is not the correct place to submit this... Any clues on how to fix, or where to look, please? Thank you.

Dropdowns work in FF and IE7. Now on IE8 I get this error:

Message: 'items[...].1' is null or not an object
Line: 167
Char: 3
Code: 0
URI: file://...../anylinkmenu.js

Line 167 is the one that begins ' frag+=...."

var menucontent=[]
var frag=""
for (var i=0; i<menuobj.items.length; i++){
frag+='<li><a href="' + menuobj.items[i][1] + '" target="' + menuobj.linktarget + '">' + menuobj.items[i][0] + '</a></li>\n'
if (menuobj.items[i][2]=="efc" || i==menuobj.items.length-1){
if (typeof menuobj.cols=="undefined")
return '<ul>\n' + menucontent.join('') + '\n</ul>'
for (var i=0; i<menucontent.length; i++){
frag+='<div class="' + menuobj.cols.divclass + '" style="' + menuobj.cols.inlinestyle + '">\n<ul>\n' + menucontent[i] + '</ul>\n</div>\n'
return frag

11-11-2009, 08:18 PM
Of course, the way to fix the problem is to post it here - then you'll find the answer yourself....

menucontents.js had a last dropdown content line that ended with "]," instead of just "]"

But (for once, in this case) good for IE8 for being picky...

Should be:
["Flickr","http://www.flickr.com/photos/kingstonurc/"] //No comma here....