title: javascript onchange event calling a function with multiple arguments
body: <p>I am having problems with the following code:
  I have n numbers of select box, whose id are differentiated by the values that the variables ModName and level take:</p>
  
  <pre><code>container.innerHTML = '&lt;form id="listToolForm_'+ModName+level+'"&gt;&lt;select id="listToolSelect_'+ModName+level+'" onChange="selValue(this.selectedIndex,'+ModName'+, level)"&gt;&lt;option value="0"&gt;---&lt;/option&gt;&lt;/select&gt;&lt;/form&gt;';
  </code></pre>
  
  <p>The select box is then populated by values taken from a database (this part is not really relevant here). With each form, there is a hidden input with id= <code>idArg'+ModName+'_lev'+level</code>, that will store the index selected by the user, using <code>onChange</code> and the function selValue(x):
  Here is the function <code>selValue(index, ModName, level)</code>:</p>
  
  <pre><code>function selValue(index, ModName, level){
      document.getElementById("idArg"+ModName+"_lev"+level).value = index;
  }
  </code></pre>
  
  <p>I tried the script setting <code>var ModName = "SL"</code>, and <code>var level = 0</code>. I get an error: 'SL is not defined'. Another test that worked is by replacing the function that fires up <code>onChange</code>:</p>
  
  <pre><code>onChange="selValue(this.selectedIndex)"
  </code></pre>
  
  <p>and </p>
  
  <pre><code>function selValue(index){
      var level = 0;
      var ModName = "SL";
      document.getElementById("idArg"+ModName+"_lev"+level).value = index;
  }
  </code></pre>
  
  <p>So if the function fired up onChange has one argument, the code works, but does not when using several arguments. I suspect it's because of the line:</p>
  
  <pre><code>onChange = "selValue(this.selectedIndex,'+ModName'+, level)"
  </code></pre>
  
  <p>I tried: </p>
  
  <pre><code>onChange="'+window["selValue"](this.selectedIndex, ModName, level)+'"
  </code></pre>
  
  <p>without success.</p>