while loop problem

  • Francis
  • Born
  • Born
  • No Avatar
  • Joined: Feb 05, 2011
  • Posts: 1
  • Status: Offline

Post February 5th, 2011, 11:20 am

my code does not work dont no why any help.. :(


<html>
<head>
<script type="text/javascript">
window.onload = function()
{
var plusButton = document.getElementById('plusButton');
var minusButton = document.getElementById('minusButton');

plusButton.onclick = function()
{
while(i = 0; i <= 10; i++)
{
alert("The number is: " + i);
}
}

minusButton.onclick = function()
{
while ( i = 0; i >= -10; i--)
{
alert("The number is: " + i);
}
}
}
</script>
</head>

<body>
Press to display the numbers 0 - 10: <button id="plusButton">Click!</button>
<br /><br />
Press to display the numbers 0 - -10: <button id="minusButton">Click!</button>
</body>

</html>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 5th, 2011, 11:20 am

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6130
  • Loc: Seattle, WA
  • Status: Offline

Post February 10th, 2011, 2:54 pm

What is your code supposed to do?
What is it doing instead?
Does it produce any error messages?
What have you tried so far while debugging it?
The Beer Monocle. Classy.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 173 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.