Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-21-2006, 06:46 PM   PM User | #1
gusblake
Regular Coder

 
Join Date: Jan 2006
Posts: 568
Thanks: 6
Thanked 84 Times in 84 Posts
gusblake is on a distinguished road
javascript nested loop problem

hi-
i have this loop in my code:

for(var x=0;x<30;x++) {
for(var y=0;y<30;y++) {
document.write(x+","+y);
}
}

as you can probably guess, its supposed to make a load of coordinates appear, but when viewed it just crashes whichever browser it's running in (tested in IE and ff). any obvious reason you guys can see why it wouldnt work? too many coordinates maybe?
gus
gusblake is offline   Reply With Quote
Old 03-21-2006, 09:27 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Works fine for me with the slight modification

<SCRIPT language="JavaScript">
for(var x=0;x<30;x++) {
for(var y=0;y<30;y++) {
document.write(x+","+y +"; ");
}
}
</SCRIPT>
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:09 PM.


Advertisement
Log in to turn off these ads.