[Typo3] JSmenu not working - gives "no properties" error

Peter Kindström peter.kindstrom at abc.se
Sun Jun 12 15:35:13 CEST 2005


Hi list!
I moved my old web pages from a 3.7.0 site to a 3.8.0 site by
using "Export/import .t3d". And suddenly my JSmenu doesn´t work
in the new 3.8.0 environment! I use TemplaVoila 0.4.0.

The selector box (JSmenu) shows alright (see below), all the
expected items are there and I can choose an item. But after I
have choosen an item, nothing happens except the error message.
The same appears both in Firefox 1.0.4 and IE 5.5.

You can test it at:
 http://www.infolagret.se/newtypo/index.php?id=53

I have checked my template and TypoScript I can´t find any
error. Am I missing something or is this a bug?
Can anyone confirm that a JSmenu like this works/does not work
in Typo3 3.8.0. with TemplaVoila 0.4.0?


/Peter Kindström


# ------------------------------------------------------
#  JavaScript error message in Web Developer Toolbar
# ------------------------------------------------------
Error: document.getElementsByTagName("base")[0] has no properties
Source file:  http://mydomain.xxx/t3lib/jsfunc.menu.js  Line: 111


# ------------------------------------------------------
#  JavaScript error message in IE 5.5.
# ------------------------------------------------------
Line: 112
Char: 4
Error: 'document.getElementsByTagName(...).0.href' is null or
not an object
Code: 0
URL: (just the page URL)


# ------------------------------------------------------
#  TypoScript menu
# ------------------------------------------------------
lib.jsMenu = HMENU
lib.jsMenu.1 = JSMENU
lib.jsMenu.1 {
  levels = 1
  1.additionalParams = class="select-menu"
  1.firstLabel = -- Välj område --
  1.showActive = 1
}


# ------------------------------------------------------
#  JavaScript in the rendered page
# ------------------------------------------------------
<script type="text/javascript">
	/*<![CDATA[*/
<!--

var JSmenu = new JSmenu(1,'JSmenuForm');
 var eid1=0;
eid1=JSmenu.add(0,0,0,'Historia','index.php%3Fid%3D63','');
eid1=JSmenu.add(0,eid1,0,'Brf%20Sundveda%20Hage','index.php%3Fid%3D56','');
JSmenu.defTopTitle[1] = unescape('--%20V%E4lj%20omr%E5de%20--');
// -->
	/*]]>*/
</script>


# ------------------------------------------------------
#  Selector box in the rendered page
# ------------------------------------------------------
<form action="" method="post" style="margin: 0 0 0 0;"
name="JSmenuForm"><select name="selector1"
onchange="JSmenu.act(1);" class="select-menu"><option
value="0">______________</option><option
value="0"></option><option value="0"></option><option
value="0"></option><option
value="0"></option></select></form><script
type="text/javascript"> /*<![CDATA[*/
JSmenu.writeOut(1,JSmenu.openID,1); /*]]>*/ </script>


# ------------------------------------------------------
#  Row 111 in "t3lib/jsfunc.menu.js"
# ------------------------------------------------------
if (document.getElementsByTagName("base")[0].href != "") {


# ------------------------------------------------------
# The whole JavaScrip function from "t3lib/jsfunc.menu.js"
# Line 10 is the one giving the error text
# ------------------------------------------------------
function JSactivate(level) {
	var selectorBox = document[this.formname]["selector"+level];
	var entryID = selectorBox.options[selectorBox.selectedIndex].value;
	if (this.entry[entryID])	{
	
this.writeOut(this.entry[entryID].child,this.entry[entryID].openID,level+1);
		if (this.entry[this.entry[entryID].parent])	{
			this.entry[this.entry[entryID].parent].openID = entryID;
		}
		if (this.entry[entryID].url)	{
			if (document.getElementsByTagName("base")[0].href != "") {
				this.entry[entryID].url =
document.getElementsByTagName("base")[0].href +
this.entry[entryID].url;
			}
			if (!this.entry[entryID].target ||
this.entry[entryID].target=="_self")	{
				document.location = this.entry[entryID].url;
			} else if (this.entry[entryID].target=="_top") {
				top.document.location = this.entry[entryID].url;
			} else {
				var test = eval ("parent."+this.entry[entryID].target);
				if (!test) {
					test = eval ("top."+this.entry[entryID].target);
				}
				if (test && test.document) {
					test.document.location = this.entry[entryID].url;
				} else {
				
window.open(this.entry[entryID].url,this.entry[entryID].target,"status=yes,menubar=yes,resizable=yes,location=yes,directories=yes,scrollbars=yes,toolbar=yes");
				}
			}
		}
	}
}



More information about the TYPO3-english mailing list