PDA

View Full Version : java script error, line 33



techmom
Mar 14th, 2007, 01:21 AM
I have a navagation bar that I just added as an include page to my template. When I preview it I get a java script error, line 33, object expected.
I have no clue how to fix this.
http://www.whirlwindpublishing.com/templatenew.htm
thanks for your help.

_Aerospace_Eng_
Mar 14th, 2007, 01:34 AM
You don't seem to have the javascript for the rollovers in the navigation to work. Its looking for a function that doesn't exist.

techmom
Mar 14th, 2007, 01:45 AM
It works ok on the home page and I just copied everything. What did I leave out? I can't figure it out at all.

http://www.whirlwindpublishing.com/

_Aerospace_Eng_
Mar 14th, 2007, 02:20 AM
This part in the head tags

<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
Also you seem to be preloading images that are on your computer.

onLoad="MM_preloadImages('/images2/navbar_1x1b.gif','images2/navbar_1x2b.gif','file:///G|/Websites2006/images/navbar_1x3b.gif','file:///G|/Websites2006/images/navbar_1x4b.gif','file:///G|/Websites2006/images/navbar_1x5b.gif','file:///G|/Websites2006/images/navbar_1x6b.gif','file:///G|/Websites2006/images/navbar_1x7b.gif','file:///G|/Websites2006/images/navbar_1x8b.gif','file:///G|/Websites2006/images/navbar_1x9b.gif')"

techmom
Mar 14th, 2007, 02:53 AM
Thanks!. I've taken care of the links to my computer files. Do I need to insert that in the head of each page or just the page with the nav bar on it that I actually use it as an include page. There is still an error showing after making those changes, but I'm going back to make sure.
thanks for your help.

_Aerospace_Eng_
Mar 14th, 2007, 03:43 AM
Just on the pages with the navbar on it. I'm not getting an error anymore.

techmom
Mar 14th, 2007, 05:02 AM
I've got the code in the head of all my pages now.
Should I remove it?

_Aerospace_Eng_
Mar 14th, 2007, 05:03 AM
Its not hurting anything but its a little useless if you don't have the menu on those pages. Its just making the page size bigger.

techmom
Mar 14th, 2007, 05:31 AM
I just tried to remove that script in the head and immediately got a java script error.
On my nav bar, I have a couple of buttons that don't mouse over. What am I missing?
http://www.whirlwindpublishing.com/navbar2.htm

_Aerospace_Eng_
Mar 14th, 2007, 06:28 AM
Sighs. You can't call ANY functions that are in the script if you remove it or you WILL get an error. I'm not sure how much more simple I can put it.

techmom
Mar 15th, 2007, 12:32 AM
Duh!!, it is finally sinking in..... Sorry about that. I started from scratch again and it is working fine. Thanks for all the advice and help.