Error Message

Page 1 of 1

1 Replies - 426 Views - Last Post: 18 January 2011 - 07:45 AM

#1 gm5660  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 52
  • Joined: 12-August 08

Error Message

Posted 17 January 2011 - 10:21 PM

Attached ImageHi all:

I am needing help with an error message and a result to get around it.

The code I have is this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title>Untitled</title>
    <script language="javascript">
	<!--
	var ball = document.getElementById("ball1");
	var xposR2L = 100;
	var xposL2R = -100;
	var timer = setInterval("start()",1);
	
	
	function start()
	{
	    goLeft();
	}
	
	function goLeft()
	{
	    xposR2L+=3;
		ball1.style.right = xposR2L + "px";
		
		if(xposR2L>=1100)
		{
	        goRight();
		}
	}
	
	function goRight()
	{    
	     xposL2R+=3;
		 ball1.style.left = xposL2R + "px";
		 if(xposL2R>=1000)
		 {
		    goLeft();
		 }				
	}
	
	function stop()
	{
	    clearInterval(timer);
		
	}
	
	//-->
	</script>
</head>

<body onload="start()">

<div id="numb"></div>

<div id="ball1" style="position:absolute;right:0">

<img src="file:///C|/Users/Owner/Documents/ball1.gif" width="30" 
                height="30" vspace="120" hspace="100" border="0" />

</div>

</body>
</html>




When I run it, the ball goes to the left Ok and then back to the starting point, then this merror message appears,"Out of Memmory".

Can anyone tell me if the stack pointer or something like that needs to be reset after the loop is finnished or is there another loop format that can be used where the 'Out of Memmory" error will not appear and stop the program?

I have attached the ball along with this code.

Any help will be appreciated.

Thanks all for the help and info.

Michael

This post has been edited by gm5660: 17 January 2011 - 10:22 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Error Message

#2 Munawwar  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 161
  • View blog
  • Posts: 457
  • Joined: 20-January 10

Re: Error Message

Posted 18 January 2011 - 07:45 AM

Do not open duplicate threads. Your previous thread is here.

Probably I wasn't clear with my last post. Your recursion runs too deep and too long + you keep calling it with the setInterval. With firefox I get a 'too much recursion' error message.

This post has been edited by Munawwar: 18 January 2011 - 07:48 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1