Jump to content

While Loop?


Twango

Recommended Posts

why isnt this working?<html><body><script type="text/javascript">var pixls=0;while (pixls<=500){var pixels=pixls + "px";document.getElementById('bigger').style.fontSize=pixels;pixls++;}</script></body></html><b id="bigger" onclick="bigrs()">WOO</b>

Link to comment
Share on other sites

You have another problem as well:

var pixels=pixls + "px";

By using var you're declaring a variable. You can only do this once, if you try to declare a variable that already exists, an error will be thrown. Each time the loop iterates, it's trying to declare the variable again.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...