PDA

View Full Version : Dynamic Drive Dynamic Ajax Contact IE Error



nicki_013
12-05-2010, 11:23 PM
I have created a portfolio website and on my video galleries I have used the tutorial Dynamic Ajax Content - http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

My site is - http://www.parkerherestudios.com/3danimation.html

Each link in the left column should show a html page in the right column that contains a video and description. It works perfectly fine in FireFox, but contains errors in Explorer and will not display the html links in the left coloumn. Anyone know how to fix this? Any help would be greatly appreciated, I am very new to javascript and php.

some code:


var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // for Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // for IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

</script>



<div id="videocontainer">
<div id="leftcolumn">
<a href="javascript:ajaxpage('videos/running.html', 'rightcolumn');">Running Man</a>
<a href="javascript:ajaxpage('videos/walk.html', 'rightcolumn');">Walk</a>
<a href="javascript:ajaxpage('videos/balls.html', 'rightcolumn');">Bouncing Balls</a>
</div>

ddadmin
12-06-2010, 01:59 AM
There may be other errors on the page, but you should remove the following initialization code from the head section of your page:


ddsmoothmenu.init({
mainmenuid: "smoothmenu2", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
//customtheme: ["#804000", "#482400"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

There is no "smoothmenu2" on your page.