Jump to content

For loop error


EdTheNerd

Recommended Posts

Below is a similar script with the same problem. It is simpler to make it easier to make head or tail of; I'm not really putting anything as silly as this on my website.

<html><head><script type="text/javascript">function rofl(){alert('rofl')}function lol(){for (n=0,n<6,n++){alert ('lol')}}</script></head><body><img onclick="rofl()" src="http://www.ubuntu.com/themes/ubuntu07/images/ubuntulogo.png" /></body></html>

Kind Regards,Ed

Link to comment
Share on other sites

It's a syntax error. You're using commas to separate the statements in the for loop rather than semi-colons. The for loop should look like this:

for (n=0;n<6;n++){alert ('lol')}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...