Web Analytics Made Easy -
StatCounter Java script error: Too much recursion / stakc overflow - CodingForum

Announcement

Collapse
No announcement yet.

Java script error: Too much recursion / stakc overflow

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java script error: Too much recursion / stakc overflow

    well, when i do this fucntion:

    function scroll(){
    window.scroll(0,60)
    }

    i get a javascript error:

    Error: too much recursion


    well, what is wrong? what does that mean? how do i fix it?

    thanks for any help

    http://www.bluephoenix.uni.cc/

  • #2
    You are creating a global function scroll. Global variables and functions are considered members of the window object. Thus you are creating a method window.scroll, which calls itself, forever. JavaScript engines normally have a max limit in the number of recursions or the time recursive execution may take.
    liorean <[[email protected]]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

    Comment


    • #3
      and even if they didn't have that which is very annoying, ur function is one of those wonderfull ethernal loops . no end only a beginning

      Comment


      • #4
        why does it loop, i never told it to loop,
        all it is supposed to do is scroll down 60px

        just like here
        http://www.bluephoenix.uni.cc/

        Comment


        • #5
          That page uses two functions, scrolldown and scroll. You, on the other hand, use a single function scroll, which calls itself. Change the name of the function to something else, and it should work ok.
          liorean <[[email protected]]>
          Articles: RegEx evolt wsabstract , Named Arguments
          Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
          Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

          Comment


          • #6
            oh, doh, i see it, lol thanks alot
            http://www.bluephoenix.uni.cc/

            Comment


            • #7
              too much recurssion error for javascript

              hi..

              I am new to java..

              I have done this as follows and getting too much recurrion error... please help...
              on createUser.jsp I have written this code..

              <script type="text/javascript">
              function confirm(userid)
              {
              var answer = confirm("Do you want continue?")
              if (answer)
              {
              var req = new Image();
              req.src = "deleteuser?a=" + userid; // passing value to servlet..
              }
              else
              {
              window.location = "CreateUser.jsp"
              }
              }
              What is wrong in this code... please reply...

              Comment


              • #8
                The answer is the same as that just given in this thread.
                "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
                Validate your HTML and CSS

                Comment

                Working...
                X