title: creating a for-loop using Javascript?
body: <p>I have a problem creating a for-loop using Javascript. It seems everyting is fine for me but still I didn't get what I want.</p>
  
  <p>Take a look please to this code to understand more:</p>
  
  <ul>
  <li><p>The HTML form code:</p>
  
  <pre><code>&lt;form name="myform"&gt;
      &lt;textarea name="inputtext" cols="100%" rows="10%"&gt;&lt;/textarea&gt;&lt;br /&gt;
      &lt;input type="radio" name="options" value="javascript" checked&gt; Option1 &lt;br /&gt;
      &lt;input type="radio" name="options" value="windows"&gt; Option2&lt;br /&gt;
      &lt;input type="button" value="Do it" onClick="generate();"&gt;&lt;br /&gt;
      &lt;textarea name="outputtext" cols="100%" rows="10%"&gt;&lt;/textarea&gt;&lt;br /&gt;
  &lt;/form&gt;
  </code></pre></li>
  <li><p>The Javascript code:</p>
  
  <pre><code>function generate() {
  var code = ""+document.myform.inputtext.value;
  if (document.myform.options[0].checked) {
      document.myform.outputtext.value = escape(code);
  }
  else {
      var result= "2- ";
      for(int i=0; i&lt;code.length; i++) {
      //There will be some logic to decide if to add the char or not.
      result+=code.charAt(i);
      }
      document.myform.outputtext.value = result;
  }
  }
  </code></pre></li>
  </ul>
  
  <p>The problem is not clear for me.
  <strong>However, when I try to comment out the for-loop, everything works fine !</strong></p>
  
  <p>Any ideas?</p>