Partage
  • Partager sur Facebook
  • Partager sur Twitter

Error javascript

Uncaught TypeError: $(...).

    23 août 2018 à 10:03:07

    Hello

    I have an error in my javascript code that I can not understand not having enough knowledge ...

    Uncaught TypeError: $(...).yoxview is not a function
    at yoxview-init.js:35

    Thanks for your help !
    Patricia

    `var yoxviewPath = getYoxviewPath();
    var cssLink = top.document.createElement("link");
    cssLink.setAttribute("rel", "Stylesheet");
    cssLink.setAttribute("type", "text/css");
    cssLink.setAttribute("href", yoxviewPath + "yoxview.css");
    top.document.getElementsByTagName("head")[0].appendChild(cssLink);
    
    function LoadScript(url)
    {
    document.write( '<scr' + 'ipt type="text/javascript" src="' + url + '"></scr' + 'ipt>' ) ;
    }
    
    var jQueryIsLoaded = typeof jQuery != "undefined";
    
    if (!jQueryIsLoaded)
    LoadScript("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
    
    LoadScript(yoxviewPath + "jquery.yoxview-2.2.min.js");
    
    function getYoxviewPath()
    {
    var scripts = document.getElementsByTagName("script");
    var regex = /(.*/)yoxview-init/i;
    for(var i=0; i<scripts.length; i++)
    {
    var currentScriptSrc = scripts[i].src;
    if (currentScriptSrc.match(regex))
    return currentScriptSrc.match(regex)[1];
    }
    
    return null;
    }
    // Remove the next line's comment to apply yoxview without knowing jQuery to all containers with class 'yoxview':
    LoadScript(yoxviewPath + "yoxview-nojquery.js");
    $(document).yoxview();`
    • Partager sur Facebook
    • Partager sur Twitter
      23 août 2018 à 10:41:39

      Hello,

      I moved your topic to the English-speaking forum :)

      The error is probably because the yowview file is not loaded. Could be check in the Network tab of your DevTools?

      • Partager sur Facebook
      • Partager sur Twitter

      Pas d'aide concernant le code par MP, le forum est là pour ça :)

        23 août 2018 à 11:49:09

        Hi
        Thank you so much for your help... Here is the address of the site
        Patricia
        • Partager sur Facebook
        • Partager sur Twitter
          23 août 2018 à 11:58:50

          But alors you are french ? (sorry if you're not, it's a quote from a movie)

          Ok, your code is very very old: topmargin and other attributes on <body> are obsoletes, <center> is obsolete…

          And your way of loading scripts is a bit complex: why not simply add jQuery & yoxview scripts before </body>?

          • Partager sur Facebook
          • Partager sur Twitter

          Pas d'aide concernant le code par MP, le forum est là pour ça :)

            23 août 2018 à 13:07:47

            Yes, I am French ;-)
            The site is old yes, I resume this site that was created by another person.

            I only added photos in the slideshow. And I realized that there was this error message in chorme devtools.

            And on the internet to explore the slideshow does not work well :-(

            I moved the scripts before closing the body!
            • Partager sur Facebook
            • Partager sur Twitter
              24 août 2018 à 14:26:50

              Hi !
              Does anyone have an idea to my problem? Thank you !
              • Partager sur Facebook
              • Partager sur Twitter
                27 août 2018 à 11:51:02

                Lamecarlate a écrit:

                But alors you are french ? (sorry if you're not, it's a quote from a movie)

                Ok, your code is very very old: topmargin and other attributes on <body> are obsoletes, <center> is obsolete…

                And your way of loading scripts is a bit complex: why not simply add jQuery & yoxview scripts before </body>?


                Do you still have some time to help me? thank you !!
                • Partager sur Facebook
                • Partager sur Twitter
                  29 août 2018 à 17:23:49

                  Actually Lamecarlate gave a correct answer. Did you try to load jQuery and yoxview before the end of body tag?

                  -
                  Edité par Xia 29 août 2018 à 17:24:56

                  • Partager sur Facebook
                  • Partager sur Twitter
                    30 août 2018 à 14:20:23

                    Hi Xia,
                    Thank you for your message !
                    Yes I moved the 2 scripts before closing the body tag. But there was no change.
                    • Partager sur Facebook
                    • Partager sur Twitter
                      30 août 2018 à 23:49:20

                      Could it be a simple order problem? I see that yoxview is included after yoxview-init.js, is it normal? If the error message is troubling you, you can avoid it with a try catch : https://www.w3schools.com/js/js_errors.asp if the website is working as it is, you could just as well get rid of it altogether...

                      • Partager sur Facebook
                      • Partager sur Twitter
                        3 septembre 2018 à 15:06:35

                        Hello, Thank you for your help Xia! I deleted this line from the file and the problem and the error disappeared! On the other hand there is always a problem of posting on internet explorer.
                        • Partager sur Facebook
                        • Partager sur Twitter

                        Error javascript

                        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                        • Editeur
                        • Markdown