Unable to modify the parent container element before the child.

Hello,

I'm using a template in Joomla which has allot of JS through it, I am receiving the below error and not sure where to begin looking for the problem, any thoughts?

Webpage Script Errors

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GoogleT5; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Timestamp: Fri, 5 Dec 2008 20:02:08 UTC


Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://92.65.62.41:8020/forum.html

vrmetroAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MMDeveloperCommented:
chances are, a javascript routine is running a little too 'early'. I tried to visit that URL you posted but it prompts for a login (and that page doesn't have any JS errors on it).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SunnyDarkCommented:
Read this:
http://support.microsoft.com/kb/927917
There are some suggestions there on how to fix it (examples included)
vrmetroAuthor Commented:
@MM

un -mm
pw - testing

I think one of the errors is derived from the attached document.  Line 74 char 3, but not sure how that needs to be edited.  You can view this error by going to the forum; my biggest error is when you select documents, IE7 will close the site because of that child element editing problem; I'm in deep sh'double hockey sticks' if I can't resolve, your help is very much appreciated.


/*------------------------------------------------------------------------
# JA Mesolite for Joomla 1.5 - Version 1.2 - Licence Owner JA123442
# ------------------------------------------------------------------------
# Copyright (C) 2004-2008 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: J.O.O.M Solutions Co., Ltd
# Websites:  http://www.joomlart.com -  http://www.joomlancers.com
# This file may not be redistributed in whole or significant part.
-------------------------------------------------------------------------*/
function switchFontSize (ckname,val){
	var bd = $E('body');
	switch (val) {
		case 'inc':
		if (CurrentFontSize+1 < 7) {
			bd.removeClass('fs'+CurrentFontSize);
			CurrentFontSize++;
			bd.addClass('fs'+CurrentFontSize);
		}
		break;
		case 'dec':
		if (CurrentFontSize-1 > 0) {
			bd.removeClass('fs'+CurrentFontSize);
			CurrentFontSize--;
			bd.addClass('fs'+CurrentFontSize);
		}
		break;
		default:
		bd.removeClass('fs'+CurrentFontSize);
		CurrentFontSize = val;
		bd.addClass('fs'+CurrentFontSize);
	}
	Cookie.set(ckname, CurrentFontSize,{duration:365});
}
 
function switchTool (ckname, val) {
	createCookie(ckname, val, 365);
	window.location.reload();
}
 
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
 
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
 
//addEvent - attach a function to an event
function jaAddEvent(obj, evType, fn){
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, false);
		return true;
	} else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}
 
function equalHeight(){	
	//
	var ja_col = $('ja-col');
	var ja_mainbody = $('ja-mainbody');
	offset = 0;
	if (ja_mainbody && ja_col && ja_mainbody.offsetHeight < ja_col.offsetHeight) {
		var offset = ja_col.offsetHeight - ja_mainbody.offsetHeight;
	}
	if ($('ja-botsl')) {
		makeEqualHeight ($('ja-botsl').getChildren(),offset);
		offset = 0;
	}
	makeEqualHeight ($$('.jazin-box'), offset);
	
}
 
function makeEqualHeight(divs, offset) {
	if (!offset) offset = 0;
	if(!divs || divs.length < 2) return;
	var maxh = 0;
	divs.each(function(el, i){
		var ch = el.getCoordinates().height;
		maxh = (maxh < ch) ? ch : maxh;
	},this);
	maxh += offset;
	divs.each(function(el, i){
		el.setStyle('height', maxh-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt());
	},this);
}
 
function getDeepestDiv (div) {
	while (div.getChildren().length==1 && (div.getChildren()[0].tagName == 'DIV'))
	{
		div = div.getChildren()[0];
	}
	return div;
}
 
function preloadImages () {
	var imgs = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var imgsrc = arguments[i];
		imgs[i] = new Image();
		imgs[i].src = imgsrc;
	}
}
 
//Add span to module title
function addSpanToTitle () {
	//var colobj = document.getElementById ('ja-col');
	//if (!colobj) return;
	var modules = getElementsByClass ('module.*', null, "div");
	if (!modules) return;
	for (var i=0; i<modules.length; i++) {
		var module = modules[i];
		var title = module.getElementsByTagName ("h3")[0];
		if (title) {
			text = title.innerHTML;
			var pos = text.indexOf(' ');
			if (pos!=-1) {
				title.innerHTML = "<span>"+text.substr(0,pos)+"</span>"+text.substr(pos);
			}else{
				title.innerHTML = "<span>"+text+"</span>";
			}
		}
	}
}
 
function makeTransBg(el, bgimgdf, sizingMethod, type, offset){
	var objs = el;
	if(!objs) return;
	if ($type(objs) != 'array') objs = [objs];
	if(!sizingMethod) sizingMethod = 'crop';
	if(!offset) offset = 0;
	var blankimg = siteurl + 'images/blank.png';
	objs.each(function(obj) {
		var bgimg = bgimgdf;
		if (obj.tagName == 'IMG') {
			//This is an image
			if (!bgimg) bgimg = obj.src;
			if (!(/\.png$/i).test(bgimg) || (/blank\.png$/i).test(bgimg)) return;
 
			obj.setStyle('height',obj.offsetHeight);
			obj.setStyle('width',obj.offsetWidth);
			obj.src = blankimg;
			obj.setStyle ('visibility', 'visible');
			obj.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
		}else{
			//Background
			if (!bgimg) bgimg = obj.getStyle('backgroundImage');
			var pattern = new RegExp('url\s*[\(\"\']*([^\'\"\)]*)[\'\"\)]*');
			if ((m = pattern.exec(bgimg))) bgimg = m[1];
			if (!(/\.png$/i).test(bgimg) || (/blank\.png$/i).test(bgimg)) return;
			if (!type)
			{
				obj.setStyles({'background': 'none'});
 
				if(obj.getStyle('position')!='absolute' && obj.getStyle('position')!='relative') {
					obj.setStyle('position', 'relative');
				}
 
				obj.getChildren().each(function(el){
					if(el.getStyle('position')!='absolute' && el.getStyle('position')!='relative')
					{
						el.setStyle('position', 'relative');
					}
					el.setStyle('z-index',2);
				});
				//Create background layer:
				var bgdiv = new Element('IMG');
				bgdiv.src = blankimg;
				bgdiv.width = obj.offsetWidth - offset;
				bgdiv.height = obj.offsetHeight - offset;
				bgdiv.setStyles({
				'position': 'absolute',
				'top': 0,
				'left': -obj.getStyle('padding-left').toInt()
				});
 
				bgdiv.className = 'TransBG';
 
				bgdiv.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
				bgdiv.inject(obj, 'top');
				//alert(obj.innerHTML + '\n' + bgdiv.innerHTML);
			} else {
				obj.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
			}
		}
	}.bind(this));
}
 
function isIE6() {
	version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	return (version && (version < 7));
}
 
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	var j = 0;
	if ( node == null )
	node = document;
	if ( tag == null )
	tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (var i = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	//alert(searchClass + j);
	return classElements;
}
 
//Add 1st item identity
jaAddFirstItemToTopmenu = function() {
	li = $E('#ja-footer ul li');
	if(li) {
		li.addClass('ja-firstitem');
	}
}
 
jaRemoveLastContentSeparator = function () {
	var els = $$('#ja-content .article_separator');
	if (els && els.length) els[els.length-1].remove();
}
 
jaRemoveLastTrBg = function () {
	var els = $$('#ja-topsl3 tr');	
	if (!els || els.length<1) return;
	var obj = els[els.length-1];
	if (els[els.length-1].innerHTML.trim()=='' && els.length>2) {
		obj.remove();
		obj = els[els.length-2];
	}
	if (obj) obj.setStyle('background','none');
}
 
window.addEvent ('load', function() {
	equalHeight();
	jaAddFirstItemToTopmenu();
	jaRemoveLastContentSeparator();
	jaRemoveLastTrBg();
	//new MenuIcon($E('#ja-mainnav'));
});
 
window.addEvent ('resize', equalHeight);

Open in new window

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

vrmetroAuthor Commented:
Ok I got the main error fixed "Unable to modify the parent container element before the child element is closed" by removing the JS at end of index calling addSpanToTitle().  Now a span isn't being added to title but oh well.

The other error JS line 74 char 3, any ideas there?

thanks
SunnyDarkCommented:
When I try the URL I hit the login page...
MMDeveloperCommented:
I'm sorry but after logging in, I cannot replicate your javascript error in IE or Firefox. I looked at the forums and a document and experienced no JS errors.
vrmetroAuthor Commented:
You were absolutely correct, was able to solve based on your insight, thank you!
thyrosCommented:
I experienced this type of error and found out that it was related to some part of javascript that was being executed on that page.

Typically you will have a <SCRIPT type="text/javascript"> type block placed somewhere within the body of your page.  If your script tried to append something to an element in the page that was not the parent of the script block, then you would get this parsing type error.  Either you have to delete the javascript script block to rectify the initial site not loading problem, then troubleshoot it by finding out which part of the javascript is trying to manipulate the elements in the page - in my own case, I had to move the script block so that the parent became BODY and not the div that it was originally enclosed in.
scm0smlCommented:
sorry for taking so long to get back to you on this.

The only javascipt i have in the page is lightbox.

I have a contentplaceholder within my head tag to allow me to dynamically add different things to the head tag per page, in this case my lightbox js includes.

This is the problem but it doesnt seem to matter how i add them to the contentplaceholder i get the proble.

If i remove them the page loads fine......

how can i work around this?
thyrosCommented:
Your site url doesn't load, and it is a bit difficult to troubleshoot something without seeing the example page in action to probe the code further.

From what you describe, the problem is not likely going to be the contentplaceholder that dynamically loads js into your head element, rather it will be the specific javascript you are loading into the page that is conflicting with the layout of the rest of your page.  For example you said you were using lightbox, try loading a different javascript into the page and see if it still gives you a problem - if it doesn't then you know the conflict source is in the lightbox script, in which case you either find an alternative lightbox script or you post a test page so we can figure out where the conflict is happening.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.