
07-12-2008, 04:26 PM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 5
|
|
|
error on website 'object expected'
Hi, I am also a newby at javascript and website design.
Just done website orrellparktherapy.co.uk
Keep getting error message...eg line 25 'object expected'
line 57 'invalid object'
Can anybody help me?
The website works okay, but this is bugging me.
Thanks for any help.
i was going to attatch the code, but is too many characters for this message, but if it is needed I can e:mail attatchment.
Thanks
Joan
|

07-12-2008, 05:03 PM
|
 |
Administrator
|
|
Join Date: Dec 2001
Location: Atlanta, Georgia, USA
Posts: 1,049
|
|
|
71 is your body tag and it's preloading an image - past that i am a js newbie - why are you preloading that image?
|

07-12-2008, 10:17 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
Okay. First of all, when dealing with javascript, I absolutely recommend using Firefox and installing the Web Developer toolbar to help debug your coding. Internet Explorer's javascript errors are completely and totally useless.
Now, onto the problem I believe you're experiencing. Following is an excerpt of your code:
Code:
<script language="JavaScript" type="text/javascript">
function mmLoadMenus() {
if (window.mm_menu_0210153040_0) return;
window.mm_menu_0210153040_0 = new Menu("root",113,18,"",12,"#FFFFFF","#666600","#99CC99","#CCFFFF","left","middle",3,0,1000,-5,7,true,false,false,0,true,true);
mm_menu_0210153040_0.addMenuItem("Acupuncture");
mm_menu_0210153040_0.hideOnMouseOut=true;
mm_menu_0210153040_0.bgColor='#555555';
mm_menu_0210153040_0.menuBorder=1;
mm_menu_0210153040_0.menuLiteBgColor='#FFFFFF';
mm_menu_0210153040_0.menuBorderBgColor='#777777';
window.mm_menu_0210154828_0 = new Menu(","#CCCCCC","#66CC66","#336600","center",3,0,1000,-5,7,true,false,true,0,true,true);
mm_menu_0210154828_0.addMenuItem(");
mm_menu_0210154828_0.fontWeight="bold";
mm_menu_0210154828_0.hideOnMouseOut=true;
mm_menu_0210154828_0.bgColor='#555555';
mm_menu_0210154828_0.menuBorder=1;
mm_menu_0210154828_0.menuLiteBgColor='#FFFFFF';
mm_menu_0210154828_0.menuBorderBgColor='#777777';
mm_menu_0210154828_0.writeMenus();
} // mmLoadMenus()t 2005 Macromedia, Inc. All rights reserved. -->
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>
The line that I have highlighted in red is where your error is originating. You open a quote near the beginning of the line, but you never terminate it. That makes the entire function invalid, meaning that you can't call that function when you try to do so right after your body tag.
__________________
I hate Internet Explorer! Anyone with me?
Last edited by curtiss; 07-12-2008 at 10:32 PM.
|

07-12-2008, 10:27 PM
|
 |
Administrator
|
|
Join Date: Dec 2001
Location: Atlanta, Georgia, USA
Posts: 1,049
|
|
|
great debugging curtiss! i dont see a red line tho
|

07-12-2008, 10:34 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
|
I put the opening tag for the color change in the wrong place (in the middle of the line). The whole line should be red, now. At least, it's showing up as red for me.
It's the first line in the second block within the mmLoadMenus function.
__________________
I hate Internet Explorer! Anyone with me?
|

07-15-2008, 06:11 PM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 5
|
|
|
error on webpage
Hi,
thanks for your reply.
I still do not see a red line, and I can't see where the tag is that you are talking about, sorry.
What do I do to reolve it? I guess I put a closing tag somewhere, may need a bit of help as to where to put it though.
Any help much appreciated.
Joan
|

07-15-2008, 06:18 PM
|
 |
Moderator
|
|
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
|
|
Here is the line that Curtiss highlighted Red
Code:
window.mm_menu_0210154828_0 = new Menu(","#CCCCCC","#66CC66","#336600","center",3,0,1000,-5,7,true,false,true,0,true,true);
mm_menu_0210154828_0.addMenuItem(");
Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
|

07-16-2008, 12:20 PM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 5
|
|
|
error on web page
And what is wrong with that line?
The other thing to say was that when you browse with Firefox, there are no errors!Regards and thanks
Joan
|

07-16-2008, 01:50 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
Joan - the problem with that line is that you open a quote and never close it.
Code:
window.mm_menu_0210154828_0 = new Menu(","#CCCCCC","#66CC66","#336600","center",3,0,1000,-5,7,true,false,true,0,true,true);
mm_menu_0210154828_0.addMenuItem(");
should be:
Code:
window.mm_menu_0210154828_0 = new Menu("","#CCCCCC","#66CC66","#336600","center",3,0,1000,-5,7,true,false,true,0,true,true);
mm_menu_0210154828_0.addMenuItem("");
Quote:
|
The other thing to say was that when you browse with Firefox, there are no errors!Regards and thanks
|
Did you install the Web Developer toolbar like I recommended? That is the extension that includes the powerful javascript debugger.
Good luck
__________________
I hate Internet Explorer! Anyone with me?
|

07-16-2008, 05:46 PM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 5
|
|
|
error on web page
Hi,
I changed that line, still got the errors.
I did try and download the Firefox Web Developer Toolbar, but it was an .xpi file and I don't know how to open it and download it.
Sorry, one technical problem leads to another!!!
Joan
|

07-17-2008, 10:36 AM
|
 |
Moderator
|
|
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
|
|
looking at your site in Firefox's firebug I get the following 3 errors.
Code:
illegal character
[Break on this error] window.mm_menu_0210154828_0 = new ...1000,-5,7,true,false,true,0,true,true);\n
orrellpa...apy.co.uk (line 25)
According to what I see you have not fixed the single quote issue on this line
Code:
window.mm_menu_0210154828_0 = new Menu(","#CCCCCC","#66CC66","#336600","center",3,0,1000,-5,7,true,false,true,0,true,true);
This is what is probably causing your error.
Code:
mmLoadMenus is not defined
orrellparktherapy.co.uk()()orrellpa...apy.co.uk (line 72)
[Break on this error] <script language="JavaScript1.2" type="text/javascript">mmLoadMenus();</script>
orrellpa...apy.co.uk (line 72)
I'm not sure why you even have this load menus call next to your table, everything should be in 1 <script> tag. Offending code is follows.
Code:
<body bgcolor="#F4FFE4" onload="MM_preloadImages('Images/rmrentaloffer.jpg')">
<script language="JavaScript1.2" type="text/javascript">mmLoadMenus();</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
Code:
MM_preloadImages is not defined
onload(load )
This is the same as the previous error.
Hope this helps
Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
Last edited by Deadeye; 07-17-2008 at 10:40 AM.
|

07-17-2008, 03:07 PM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 5
|
|
|
error on web page
Thanks for that information, that is really helpful.
My problem now is i don't really understand javascript and do not know how to correct that.
I am sorry for being a bit dim here.
I did correct the single quote issue on my computer and only tested it in dreamweaver, because I still got the same errors i didn't upload the amended webpage.
Thanks
Joan
|

07-17-2008, 11:06 PM
|
 |
Moderator
|
|
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
|
|
No problem. I would recomend reading a few tutorials on javascript.
I would start here
Javascript tutorials
If you still need more help after reviewing these please post away and we'll try to help you as we can.
Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
|

07-19-2008, 12:04 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
|
For further information, the reason the error "mmLoadMenus is not defined" is coming up is because of the single quote error previously mentioned.
Because the javascript interpreter cannot successfully walk through the function definitions at the top of the file, it abandons the functions altogether. That's why it is telling you that the function doesn't exist.
__________________
I hate Internet Explorer! Anyone with me?
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:08 PM.
|
|
|