Combining 2 variables in to 1 to call an ID
<p>I am trying to create the following code in a function that will repeat it a variable number of times</p>

<pre><code>myId##.className = myId##.className.replace(' class1',' class2')
</code></pre>

<p>so far I have come up with the following but it is not working.</p>

<pre><code>function toggle(partId,orig,rep,itr)
{
var partId; // Begining of Id string
var orig;  // Original Class
var rep;  // Replacement Class
var itr;  // Total number to be iterated through
var num = 1; // Starting at 1
var finalId; // for partId + num
while (num&lt;=itr)
 {
 finalId = partId + num;
 finalId.className = finalId.className.replace(orig,rep);
 num++;
 }
}
</code></pre>

<p>I then implemented it like so.</p>

<pre><code>&lt;area shape="circle" coords="933,92,23" 
      alt="myAlt" href="#none" 
      onmouseover="toggle('myPartId',' class1',' class2',5)"
      onmouseout="toggle('myPartId',' class1',' class2',5)" /&gt;
</code></pre>

<p>So I thought I could supplement the ID node in <code>className</code> and I am ether doing it wrong or I am wrong in that it can not be done.</p>

<p>Any help would be greatly appreciated.</p>
