...

View Full Version : Resolved Object expected - IE Error



Redman-Racer
11-18-2010, 05:59 AM
The website is CnJ-Tree.atwebpages.com

The site works in everything, except, IE. Of course, never fails right.

Anyway, the error is with the navigation. I keep getting object expected errors, on pretty much all of my onMouseOver, onMouseOut, and onClick events.

Here is the html.


<tr>
<td background="images/CnJ-Layout_04.png" width="720" height="28" valign="middle" align="center">
<div id="container" class="navigation">

<a href="#" onClick="openPage('home.php');"><div id="home" class="home" align="center" onMouseOver="navOpen('home');" onMouseOut="navClose('home');">Home</div></a>

<a href="#" onClick="openPage('contact.php')"><div id="contact" class="contact" align="center" onMouseOver="navOpen('contact')" onMouseOut="navClose('contact')">Contact Us</div></a>

<div id="service" class="service" align="center" onMouseOver="mopen('serviceDropDown'); navOpen('service');"
onMouseOut="mclosetime(); navClose('service');" style="cursor:pointer">Services</div>

<div id="serviceDropDown" class="serviceDropDown" align="center" onMouseOver="mcancelclosetime(); navOpen('service');"
onMouseOut="mclosetime(); navClose('service');" style="visibility: hidden">
<div id="tree" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('tree')" onMouseOut="navClose('tree')">Tree Removal</div>
<div id="trimming" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('trimming')" onMouseOut="navClose('trimming')">Tree Trimming</div>
<div id="hauling" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('hauling')" onMouseOut="navClose('hauling')">Any Hauling</div>
</div>

<div id="about" class="about" align="center" onMouseOver="navOpen('about')" onMouseOut="navClose('about')">About Us</div>

<div id="gallery" class="gallery" align="center" onMouseOver="navOpen('gallery')" onMouseOut="navClose('gallery')">Gallery</div>
</div>
</td>
</tr>

And here is the JS for the related areas.



<script type="text/javascript">
var xmlhttp

window.onload=function(){
var dotspan = document.getElementById('dots');
window.setInterval(function(){
if(dotspan.innerHTML == '...'){
dotspan.innerHTML = '.';
}
else{
dotspan.innerHTML += '.';
}
}, 200);

// Initiate AJAX usage
try { xmlhttp = new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
catch(e){
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } // Internet Explorer
catch(e){
try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // Internet Explorer
catch(e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
}

function navOpen(page)
{
document.getElementById(page).style.backgroundImage = "url(images/navi-rollover.png)";
document.getElementById(page).style.color = "#787864";

}

function navClose(page)
{
document.getElementById(page).style.backgroundImage = "";
document.getElementById(page).style.color = "#9b9b80";
}

var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

// open hidden layer
function mopen(id)
{
// cancel close timer
mcancelclosetime();

// close old layer
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

// get new layer and show it
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
if(closetimer)
{
window.clearTimeout(closetimer);
closetimer = null;
}
}

// close layer when click-out
document.onClick = mclose;


window.onload=function(){
// Initiate AJAX usage
try { xmlhttp = new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
catch(e){
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } // Internet Explorer
catch(e){
try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // Internet Explorer
catch(e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
}

function openPage(id)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support XMLHTTP!");
return;
}
var url=id;
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState !=4){
document.getElementById("main").innerHTML=("<center><img src='http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif'></center>");
}
else{

document.getElementById("main").innerHTML=xmlhttp.responseText;
}
}
;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}

}
</script>

Old Pedant
11-18-2010, 06:49 AM
This code is bogus:


if (passcheck == "No") {
break;
}

I think you mean to have return there, not break.

Once you get that error, all bets are off.

Anyway, MSIE is complaining about mopen( ). Fix that first bug and see if the other goes away.

Redman-Racer
11-18-2010, 06:53 AM
OO :O :), that was simple.

Thanks, now I got some layout problems in the contact page. Thats another forum though,

THanks again.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum