JavaScript For Loop

Here is an example of the JavaScript for loop (which is identical to the PHP for loop). Again I used Prototype. This basic example illustrates hiding multiple divs. So for example if you dynamically generate a page with divs you can show or hide them with an onchange() function call to something like this.

JAVASCRIPT:
  1. if ($F('validationid').toString() == '18'){
  2.    for (i=0; i<=10; i++){ Element.show('subsetList'+i); }
  3. }

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank

Home | JavaScript | JavaScript For Loop