Script Error

Discussion in 'HTML' started by Helpless Soul, Jul 14, 2008.

  1. 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
     
    Helpless Soul, Jul 14, 2008
    #1
    1. Advertising

  2. 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
     
    Harlan Messinger, Jul 14, 2008
    #2
    1. Advertising

  3. 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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
    }

    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr;
    for(i=0;a&&i<a.length&&(x=a)&&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[n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=MM_findObj(n,d.layers.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))!=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
     
    Helpless Soul, Jul 14, 2008
    #3
  4. 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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
    > }
    >
    > function MM_swapImgRestore() { //v3.0
    > var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&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[n];
    > for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    > x=MM_findObj(n,d.layers.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))!=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.
     
    Harlan Messinger, Jul 14, 2008
    #4
  5. 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.
     
    Travis Newbury, Jul 14, 2008
    #5
  6. 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    >> d.MM_p[j++].src=a;}}
    >> }
    >>
    >> function MM_swapImgRestore() { //v3.0
    >> var i,x,a=document.MM_sr;
    >> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    >> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    >> x=MM_findObj(n,d.layers.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))!=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
     
    Helpless Soul, Jul 15, 2008
    #6
  7. 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    >>> d.MM_p[j++].src=a;}}
    >>> }
    >>>
    >>> function MM_swapImgRestore() { //v3.0
    >>> var i,x,a=document.MM_sr;
    >>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    >>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    >>> x=MM_findObj(n,d.layers.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))!=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?
     
    Harlan Messinger, Jul 15, 2008
    #7
  8. 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    >>>> d.MM_p[j++].src=a;}}
    >>>> }
    >>>>
    >>>> function MM_swapImgRestore() { //v3.0
    >>>> var i,x,a=document.MM_sr;
    >>>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    >>>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    >>>> x=MM_findObj(n,d.layers.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))!=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
     
    Helpless Soul, Jul 15, 2008
    #8
  9. Helpless Soul

    Hopeless Guest

    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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    >>>>> d.MM_p[j++].src=a;}}
    >>>>> }
    >>>>>
    >>>>> function MM_swapImgRestore() { //v3.0
    >>>>> var i,x,a=document.MM_sr;
    >>>>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    >>>>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    >>>>> x=MM_findObj(n,d.layers.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))!=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
     
    Hopeless, Jul 23, 2008
    #9
  10. Helpless Soul

    billbitt96 Guest

    On Jul 23, 4:21 am, Hopeless <> 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    > >>>>> d.MM_p[j++].src=a;}}
    > >>>>> }

    >
    > >>>>> function MM_swapImgRestore() { //v3.0
    > >>>>> var i,x,a=document.MM_sr;
    > >>>>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    > >>>>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    > >>>>> x=MM_findObj(n,d.layers.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))!=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.
     
    billbitt96, Jul 25, 2008
    #10
  11. Helpless Soul

    billbitt96 Guest

    On Jul 25, 3:57 pm, billbitt96 <> wrote:
    > On Jul 23, 4:21 am, Hopeless <> 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    > > >>>>> d.MM_p[j++].src=a;}}
    > > >>>>> }

    >
    > > >>>>> function MM_swapImgRestore() { //v3.0
    > > >>>>> var i,x,a=document.MM_sr;
    > > >>>>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    > > >>>>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    > > >>>>> x=MM_findObj(n,d.layers.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))!=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.


    Put this at the top of all your scripts you need the type of script or
    it will never run in new browsers:

    <script type="text/javascript" LANGUAGE="JavaScript">

    Put this at the bottom:
    </script>
     
    billbitt96, Jul 25, 2008
    #11
  12. Gazing into my crystal ball I observed billbitt96 <>
    writing in news:0b7e6244-2822-47d4-a84a-85def0dba358
    @y21g2000hsf.googlegroups.com:

    > Put this at the top of all your scripts you need the type of script or
    > it will never run in new browsers:
    >
    ><script type="text/javascript" LANGUAGE="JavaScript">
    >
    > Put this at the bottom:
    ></script>
    >


    You do need type, but language is deprecated. Of course, even better is
    an external script, eg. <script type="text/javascript"
    src="masterfunctions.js"></script>.

    --
    Adrienne Boswell at Home
    Arbpen Designs
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Jul 26, 2008
    #12
  13. billbitt96 wrote:
    > On Jul 25, 3:57 pm, billbitt96 <> wrote:
    >> On Jul 23, 4:21 am, Hopeless <> 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.indexOf("#")!=0){ d.MM_p[j]=new Image;
    >>>>>>>> d.MM_p[j++].src=a;}}
    >>>>>>>> }
    >>>>>>>> function MM_swapImgRestore() { //v3.0
    >>>>>>>> var i,x,a=document.MM_sr;
    >>>>>>>> for(i=0;a&&i<a.length&&(x=a)&&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[n];
    >>>>>>>> for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    >>>>>>>> x=MM_findObj(n,d.layers.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))!=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.

    >
    > Put this at the top of all your scripts you need the type of script or
    > it will never run in new browsers:
    >
    > <script type="text/javascript" LANGUAGE="JavaScript">
    >
    > Put this at the bottom:
    > </script>


    Hi.
    No, I never solved the issue.
    I have this in the head:
    <script type="text/javascript" src="script.js"></script>

    The (index) page is designed to highlight linked rollover buttons. The
    pages that these link to are the ones that work (they have the same
    buttons on them). I've tried cutting the code from these and placing it
    in the index page but the script then gave the same error. In the end I
    gave up and rewrote the rollover code using this script:

    <script language="JavaScript" type="text/javascript">
    <!--
    function na_preload_img()
    {
    var img_list = na_preload_img.arguments;
    if (document.preloadlist == null)
    document.preloadlist = new Array();
    var top = document.preloadlist.length;
    for (var i=0; i < img_list.length-1; i++) {
    document.preloadlist[top+i] = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
    }
    }

    function na_change_img_src(name, nsdoc, rpath, preload)
    {
    var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ?
    nsdoc+'.'+name : 'document.all.'+name);
    if (name == '')
    return;
    if (img) {
    img.altsrc = img.src;
    img.src = rpath;
    }
    }

    function na_restore_img_src(name, nsdoc)
    {
    var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ?
    nsdoc+'.'+name : 'document.all.'+name);
    if (name == '')
    return;
    if (img && img.altsrc) {
    img.src = img.altsrc;
    img.altsrc = null;
    }
    }

    // -->
    </script>


    That works.
     
    Helpless Soul, Jul 26, 2008
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TG93bGFuZGVy?=
    Replies:
    0
    Views:
    381
    =?Utf-8?B?TG93bGFuZGVy?=
    Mar 27, 2007
  2. -Karl
    Replies:
    2
    Views:
    434
    -Karl
    Jun 18, 2007
  3. sophie_newbie

    Error when python script run as cgi script

    sophie_newbie, Oct 21, 2007, in forum: Python
    Replies:
    3
    Views:
    615
    Dennis Lee Bieber
    Oct 22, 2007
  4. Rajat
    Replies:
    3
    Views:
    721
    Jorgen Grahn
    Jan 8, 2010
  5. VYAS ASHISH M-NTB837
    Replies:
    2
    Views:
    583
    Jan Kaliszewski
    Jan 7, 2010
Loading...

Share This Page