View Full Version : Java script error: Too much recursion / stakc overflow
JAVAEOC
03-07-2004, 02:20 AM
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
:D
liorean
03-07-2004, 02:25 AM
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.
Garadon
03-07-2004, 07:06 AM
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
JAVAEOC
03-07-2004, 02:29 PM
why does it loop, i never told it to loop, :confused:
all it is supposed to do is scroll down 60px :(
just like here (http://www.w3schools.com/js/tryit.asp?filename=tryjs_scrolldown)
liorean
03-07-2004, 02:34 PM
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.
JAVAEOC
03-07-2004, 02:58 PM
oh, doh, i see it, lol thanks alot :)
nivida
04-26-2011, 08:54 PM
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...
AndrewGSW
04-26-2011, 09:11 PM
The answer is the same as that just given in this thread.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.