Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Script Error

Reply
Thread Tools

Script Error

 
 
Helpless Soul
Guest
Posts: n/a
 
      07-14-2008
I am getting the following error on a webpage:

Char 1
Error Object Expected
Code 0


Here is the page source that's throwing the error:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test Page</title>
<meta http-equiv="content-language" content="en-us" />

<meta http-equiv="imagetoolbar" content="no" />
<meta name="mssmarttagspreventparsing" content="true" />

<meta name="description" content="content here" />

<meta name="keywords" content="test1,test2" />

<meta name="author" content="solutions" />

<style type="text/css" media="all">
@import "css/master.css";
@import "css/homepage.css";
</style>
<script type="text/javascript" src="script.js"></script>

</head>

<body
onload="mm_preloadimages('imagery/menu/aboutus_over.jpg','imagery/menu/membership_over.jpg','imagery/menu/racehorses_over.jpg','imagery/menu/trainers_over.jpg','imagery/menu/news_over.jpg','imagery/menu/racecourse_over.jpg','imagery/menu/bloodstock_over.jpg','imagery/menu/contact_over.jpg','imagery/menu/links_over.jpg');">

<div id="header"><img src="imagery/general/header.jpg" alt="alt text"
width="696" height="81" /></div>

<div id="container">

<div id="leftcolumn">

<div id="menu">

<div id="button"><a href="index.htm"><img
src="imagery/menu/home_over.jpg" alt="home" name="home" width="155"
height="22" border="0" id="home"
onmouseover="mm_swapimage('home','','imagery/menu/home_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="aboutus.htm"><img
src="imagery/menu/aboutus.jpg" alt="about us" name="about" width="155"
height="22" border="0" id="about"
onmouseover="mm_swapimage('about','','imagery/menu/aboutus_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="membership.htm"><img
src="imagery/menu/membership.jpg" alt="membership" name="membership"
width="155" height="22" border="0" id="membership"
onmouseover="mm_swapimage('membership','','imagery/menu/membership_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="ownershipshare.htm"><img
src="imagery/menu/ownership.jpg" alt="ownerhip share" name="ownership"
width="155" height="22" border="0" id="ownership"
onmouseover="mm_swapimage('ownership','','imagery/menu/ownership_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="racehorses.htm"><img
src="imagery/menu/racehorses.jpg" alt="racehorses" name="racehorses"
width="155" height="22" border="0" id="racehorses"
onmouseover="mm_swapimage('racehorses','','imagery/menu/racehorses_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="trainers.htm"><img
src="imagery/menu/trainers.jpg" alt="trainers" name="trainers"
width="155" height="22" border="0" id="trainers"
onmouseover="mm_swapimage('trainers','','imagery/menu/trainers_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="news.htm"><img src="imagery/menu/news.jpg"
alt="news &amp; results" name="news" width="155" height="22" border="0"
id="news"
onmouseover="mm_swapimage('news','','imagery/menu/news_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="contactus.htm"><img
src="imagery/menu/contact.jpg" alt="contact us" name="contact"
width="155" height="22" border="0" id="contact"
onmouseover="mm_swapimage('contact','','imagery/menu/contact_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
<div id="button"><a href="links.htm"><img
src="imagery/menu/links.jpg" alt="links" name="links" width="155"
height="22" border="0" id="links"
onmouseover="mm_swapimage('links','','imagery/menu/links_over.jpg',1)"
onmouseout="mm_swapimgrestore()" /></a></div>
</div>

</body>
</html>


Can anyone help me solve this riddle?

Thanks
Soul
 
Reply With Quote
 
 
 
 
Harlan Messinger
Guest
Posts: n/a
 
      07-14-2008
I'm a little uncertain about how to ask you the obvious question,
because if you understand that this is a scripting error, then it would
certainly have occurred to you that one would need to see the script in
order to debug it, and if you don't know that it's a scripting error and
don't know what "script" is then I wouldn't expect you to have been
given the assignment of debugging this error.

Helpless Soul wrote:
> I am getting the following error on a webpage:
>
> Char 1
> Error Object Expected
> Code 0
>
>
> Here is the page source that's throwing the error:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html>
>
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
> <title>Test Page</title>
> <meta http-equiv="content-language" content="en-us" />
>
> <meta http-equiv="imagetoolbar" content="no" />
> <meta name="mssmarttagspreventparsing" content="true" />
>
> <meta name="description" content="content here" />
>
> <meta name="keywords" content="test1,test2" />
>
> <meta name="author" content="solutions" />
>
> <style type="text/css" media="all">
> @import "css/master.css";
> @import "css/homepage.css";
> </style>
> <script type="text/javascript" src="script.js"></script>
>
> </head>
>
> <body
> onload="mm_preloadimages('imagery/menu/aboutus_over.jpg','imagery/menu/membership_over.jpg','imagery/menu/racehorses_over.jpg','imagery/menu/trainers_over.jpg','imagery/menu/news_over.jpg','imagery/menu/racecourse_over.jpg','imagery/menu/bloodstock_over.jpg','imagery/menu/contact_over.jpg','imagery/menu/links_over.jpg');">
>
>
> <div id="header"><img src="imagery/general/header.jpg" alt="alt text"
> width="696" height="81" /></div>
>
> <div id="container">
>
> <div id="leftcolumn">
>
> <div id="menu">
>
> <div id="button"><a href="index.htm"><img
> src="imagery/menu/home_over.jpg" alt="home" name="home" width="155"
> height="22" border="0" id="home"
> onmouseover="mm_swapimage('home','','imagery/menu/home_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="aboutus.htm"><img
> src="imagery/menu/aboutus.jpg" alt="about us" name="about" width="155"
> height="22" border="0" id="about"
> onmouseover="mm_swapimage('about','','imagery/menu/aboutus_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="membership.htm"><img
> src="imagery/menu/membership.jpg" alt="membership" name="membership"
> width="155" height="22" border="0" id="membership"
> onmouseover="mm_swapimage('membership','','imagery/menu/membership_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="ownershipshare.htm"><img
> src="imagery/menu/ownership.jpg" alt="ownerhip share" name="ownership"
> width="155" height="22" border="0" id="ownership"
> onmouseover="mm_swapimage('ownership','','imagery/menu/ownership_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="racehorses.htm"><img
> src="imagery/menu/racehorses.jpg" alt="racehorses" name="racehorses"
> width="155" height="22" border="0" id="racehorses"
> onmouseover="mm_swapimage('racehorses','','imagery/menu/racehorses_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="trainers.htm"><img
> src="imagery/menu/trainers.jpg" alt="trainers" name="trainers"
> width="155" height="22" border="0" id="trainers"
> onmouseover="mm_swapimage('trainers','','imagery/menu/trainers_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="news.htm"><img
> src="imagery/menu/news.jpg" alt="news &amp; results" name="news"
> width="155" height="22" border="0" id="news"
> onmouseover="mm_swapimage('news','','imagery/menu/news_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="contactus.htm"><img
> src="imagery/menu/contact.jpg" alt="contact us" name="contact"
> width="155" height="22" border="0" id="contact"
> onmouseover="mm_swapimage('contact','','imagery/menu/contact_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> <div id="button"><a href="links.htm"><img
> src="imagery/menu/links.jpg" alt="links" name="links" width="155"
> height="22" border="0" id="links"
> onmouseover="mm_swapimage('links','','imagery/menu/links_over.jpg',1)"
> onmouseout="mm_swapimgrestore()" /></a></div>
> </div>
>
> </body>
> </html>
>
>
> Can anyone help me solve this riddle?
>
> Thanks
> Soul

 
Reply With Quote
 
 
 
 
Helpless Soul
Guest
Posts: n/a
 
      07-14-2008
It's a website I inherited, that's why I am looking at it.

Here is the script (script.js):

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_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_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];}
}


HTH


SOul




Harlan Messinger wrote:
> I'm a little uncertain about how to ask you the obvious question,
> because if you understand that this is a scripting error, then it would
> certainly have occurred to you that one would need to see the script in
> order to debug it, and if you don't know that it's a scripting error and
> don't know what "script" is then I wouldn't expect you to have been
> given the assignment of debugging this error.
>
> Helpless Soul wrote:
>> I am getting the following error on a webpage:
>>
>> Char 1
>> Error Object Expected
>> Code 0
>>
>>
>> Here is the page source that's throwing the error:
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html>
>>
>> <head>
>> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
>> <title>Test Page</title>
>> <meta http-equiv="content-language" content="en-us" />
>> <meta http-equiv="imagetoolbar" content="no" />
>> <meta name="mssmarttagspreventparsing" content="true" />
>> <meta name="description" content="content here" />
>> <meta name="keywords" content="test1,test2" />
>> <meta name="author" content="solutions" />
>> <style type="text/css" media="all">
>> @import "css/master.css";
>> @import "css/homepage.css";
>> </style>
>> <script type="text/javascript" src="script.js"></script>
>> </head>
>>
>> <body
>> onload="mm_preloadimages('imagery/menu/aboutus_over.jpg','imagery/menu/membership_over.jpg','imagery/menu/racehorses_over.jpg','imagery/menu/trainers_over.jpg','imagery/menu/news_over.jpg','imagery/menu/racecourse_over.jpg','imagery/menu/bloodstock_over.jpg','imagery/menu/contact_over.jpg','imagery/menu/links_over.jpg');">
>>
>>
>> <div id="header"><img src="imagery/general/header.jpg" alt="alt text"
>> width="696" height="81" /></div>
>>
>> <div id="container">
>>
>> <div id="leftcolumn">
>>
>> <div id="menu">
>> <div id="button"><a href="index.htm"><img
>> src="imagery/menu/home_over.jpg" alt="home" name="home" width="155"
>> height="22" border="0" id="home"
>> onmouseover="mm_swapimage('home','','imagery/menu/home_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="aboutus.htm"><img
>> src="imagery/menu/aboutus.jpg" alt="about us" name="about" width="155"
>> height="22" border="0" id="about"
>> onmouseover="mm_swapimage('about','','imagery/menu/aboutus_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="membership.htm"><img
>> src="imagery/menu/membership.jpg" alt="membership" name="membership"
>> width="155" height="22" border="0" id="membership"
>> onmouseover="mm_swapimage('membership','','imagery/menu/membership_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="ownershipshare.htm"><img
>> src="imagery/menu/ownership.jpg" alt="ownerhip share" name="ownership"
>> width="155" height="22" border="0" id="ownership"
>> onmouseover="mm_swapimage('ownership','','imagery/menu/ownership_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="racehorses.htm"><img
>> src="imagery/menu/racehorses.jpg" alt="racehorses" name="racehorses"
>> width="155" height="22" border="0" id="racehorses"
>> onmouseover="mm_swapimage('racehorses','','imagery/menu/racehorses_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="trainers.htm"><img
>> src="imagery/menu/trainers.jpg" alt="trainers" name="trainers"
>> width="155" height="22" border="0" id="trainers"
>> onmouseover="mm_swapimage('trainers','','imagery/menu/trainers_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="news.htm"><img
>> src="imagery/menu/news.jpg" alt="news &amp; results" name="news"
>> width="155" height="22" border="0" id="news"
>> onmouseover="mm_swapimage('news','','imagery/menu/news_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="contactus.htm"><img
>> src="imagery/menu/contact.jpg" alt="contact us" name="contact"
>> width="155" height="22" border="0" id="contact"
>> onmouseover="mm_swapimage('contact','','imagery/menu/contact_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> <div id="button"><a href="links.htm"><img
>> src="imagery/menu/links.jpg" alt="links" name="links" width="155"
>> height="22" border="0" id="links"
>> onmouseover="mm_swapimage('links','','imagery/menu/links_over.jpg',1)"
>> onmouseout="mm_swapimgrestore()" /></a></div>
>> </div>
>> </body>
>> </html>
>>
>>
>> Can anyone help me solve this riddle?
>>
>> Thanks
>> Soul

 
Reply With Quote
 
Harlan Messinger
Guest
Posts: n/a
 
      07-14-2008
Helpless Soul wrote:
> It's a website I inherited, that's why I am looking at it.
>
> Here is the script (script.js):
>
> 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_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_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];}
> }


This is ancient, oft-pasted code that may still work in all the
mainstream browsers for preloading images and creating rollovers, except
for one thing: Javascript is case-sensitive. A function named
MM_preloadImages is not going to be executed by code that calls a
function named mm_preloadimages, and likewise for the remaining
functions. Fix this in your HTML page.
 
Reply With Quote
 
Travis Newbury
Guest
Posts: n/a
 
      07-14-2008
On Jul 14, 12:23*pm, Helpless Soul <Soul> wrote:
> Can anyone help me solve this riddle?


Probably not without a URL. Or were you expecting us to create a
dummy page, post your code in it, debug it, and post your solution
here.
 
Reply With Quote
 
Helpless Soul
Guest
Posts: n/a
 
      07-15-2008
Harlan Messinger wrote:
> Helpless Soul wrote:
>> It's a website I inherited, that's why I am looking at it.
>>
>> Here is the script (script.js):
>>
>> 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_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_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];}
>> }

>
> This is ancient, oft-pasted code that may still work in all the
> mainstream browsers for preloading images and creating rollovers, except
> for one thing: Javascript is case-sensitive. A function named
> MM_preloadImages is not going to be executed by code that calls a
> function named mm_preloadimages, and likewise for the remaining
> functions. Fix this in your HTML page.


I think that is incorrect - the page does "work" but throws the error.
Several near identical pages also work flawlessly.
Soul
 
Reply With Quote
 
Harlan Messinger
Guest
Posts: n/a
 
      07-15-2008
Helpless Soul wrote:
> Harlan Messinger wrote:
>> Helpless Soul wrote:
>>> It's a website I inherited, that's why I am looking at it.
>>>
>>> Here is the script (script.js):
>>>
>>> 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_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_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];}
>>> }

>>
>> This is ancient, oft-pasted code that may still work in all the
>> mainstream browsers for preloading images and creating rollovers,
>> except for one thing: Javascript is case-sensitive. A function named
>> MM_preloadImages is not going to be executed by code that calls a
>> function named mm_preloadimages, and likewise for the remaining
>> functions. Fix this in your HTML page.

>
> I think that is incorrect - the page does "work" but throws the error.
> Several near identical pages also work flawlessly.


No, it doesn't work, and when I changed the case of the function names
in the HTML file to match the case in the JS file, the error went away. OK?
 
Reply With Quote
 
Helpless Soul
Guest
Posts: n/a
 
      07-15-2008
Harlan Messinger wrote:
> Helpless Soul wrote:
>> Harlan Messinger wrote:
>>> Helpless Soul wrote:
>>>> It's a website I inherited, that's why I am looking at it.
>>>>
>>>> Here is the script (script.js):
>>>>
>>>> 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_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_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];}
>>>> }
>>>
>>> This is ancient, oft-pasted code that may still work in all the
>>> mainstream browsers for preloading images and creating rollovers,
>>> except for one thing: Javascript is case-sensitive. A function named
>>> MM_preloadImages is not going to be executed by code that calls a
>>> function named mm_preloadimages, and likewise for the remaining
>>> functions. Fix this in your HTML page.

>>
>> I think that is incorrect - the page does "work" but throws the error.
>> Several near identical pages also work flawlessly.

>
> No, it doesn't work, and when I changed the case of the function names
> in the HTML file to match the case in the JS file, the error went away. OK?


My test last night didn't confirm that, but I have re-read your post and
it seems that I overlooked some of the caps. In fact, I only changed the
MM to mm (no you know where I got my posting nick from).
I will have another go and report back.
Thanks a lot Harlan.

Soul
 
Reply With Quote
 
Hopeless
Guest
Posts: n/a
 
      07-23-2008
Helpless Soul wrote:
> Harlan Messinger wrote:
>> Helpless Soul wrote:
>>> Harlan Messinger wrote:
>>>> Helpless Soul wrote:
>>>>> It's a website I inherited, that's why I am looking at it.
>>>>>
>>>>> Here is the script (script.js):
>>>>>
>>>>> 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_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_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];}
>>>>> }
>>>>
>>>> This is ancient, oft-pasted code that may still work in all the
>>>> mainstream browsers for preloading images and creating rollovers,
>>>> except for one thing: Javascript is case-sensitive. A function named
>>>> MM_preloadImages is not going to be executed by code that calls a
>>>> function named mm_preloadimages, and likewise for the remaining
>>>> functions. Fix this in your HTML page.
>>>
>>> I think that is incorrect - the page does "work" but throws the
>>> error. Several near identical pages also work flawlessly.

>>
>> No, it doesn't work, and when I changed the case of the function names
>> in the HTML file to match the case in the JS file, the error went
>> away. OK?

>
> My test last night didn't confirm that, but I have re-read your post and
> it seems that I overlooked some of the caps. In fact, I only changed the
> MM to mm (no you know where I got my posting nick from).
> I will have another go and report back.
> Thanks a lot Harlan.
>
> Soul



OK, still couldn't get it to work. Wasn't sure whether I should change
the script to all lower case, or change the html? I tried both and
neither worked. As I already said, my linked pages that have the same
(well, very similar) menus all work.
Anyway, thanks for your help,

Hopeless
 
Reply With Quote
 
billbitt96
Guest
Posts: n/a
 
      07-25-2008
On Jul 23, 4:21 am, Hopeless <(E-Mail Removed)> wrote:
> Helpless Soul wrote:
> > Harlan Messinger wrote:
> >> Helpless Soul wrote:
> >>> Harlan Messinger wrote:
> >>>> Helpless Soul wrote:
> >>>>> It's a website I inherited, that's why I am looking at it.

>
> >>>>> Here is the script (script.js):

>
> >>>>> 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_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_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];}
> >>>>> }

>
> >>>> This is ancient, oft-pasted code that may still work in all the
> >>>> mainstream browsers for preloading images and creating rollovers,
> >>>> except for one thing: Javascript is case-sensitive. A function named
> >>>> MM_preloadImages is not going to be executed by code that calls a
> >>>> function named mm_preloadimages, and likewise for the remaining
> >>>> functions. Fix this in your HTML page.

>
> >>> I think that is incorrect - the page does "work" but throws the
> >>> error. Several near identical pages also work flawlessly.

>
> >> No, it doesn't work, and when I changed the case of the function names
> >> in the HTML file to match the case in the JS file, the error went
> >> away. OK?

>
> > My test last night didn't confirm that, but I have re-read your post and
> > it seems that I overlooked some of the caps. In fact, I only changed the
> > MM to mm (no you know where I got my posting nick from).
> > I will have another go and report back.
> > Thanks a lot Harlan.

>
> > Soul

>
> OK, still couldn't get it to work. Wasn't sure whether I should change
> the script to all lower case, or change the html? I tried both and
> neither worked. As I already said, my linked pages that have the same
> (well, very similar) menus all work.
> Anyway, thanks for your help,
>
> Hopeless


Did you ever solve this or everyone dropped the issue. Maybe I am not
looking everywhere but it seems that mm_sr is not defined anywhere. It
is some kind of array based on the document model in your browser. Can
you show me the code where its defined? Better yet, cut and paste one
of your other functions which are working, you referred to those. You
said some are working but this one doesn't work. Let me look them over
and see where its all defined in those and compare the two of them.
Trouble is on posts like this we always just get the broken code and
trial and error or reading it is the only way to find bugs. It could
be something like a hidden character as well. Let met try to adapt
peice by peice some code that works already and I'll get back to you
for this one that's broken. Its my approach, step by step, not trying
to eat the entire pie at once. I have this on in my Sharepoint
Developer already and I doing it the hard way now. But if you send me
one that is working I can compare faster.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute a script from another script and other script does notdo busy wait. Rajat Python 3 01-08-2010 02:05 PM
RE: How to execute a script from another script and other script doesnotdo busy wait. VYAS ASHISH M-NTB837 Python 2 01-07-2010 08:18 PM
Error when python script run as cgi script sophie_newbie Python 3 10-22-2007 05:39 PM
error when using <% %>and <script></script> tags -Karl ASP .Net 2 06-18-2007 02:55 PM
Odd script error when using client script callbacks (ASP.NET 2.0) =?Utf-8?B?TG93bGFuZGVy?= ASP .Net 0 03-27-2007 10:30 PM



Advertisments