while loop problem

  • Francis
  • Born
  • Born
  • Francis
  • Posts: 1

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

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?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 47 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.