title: Dynamically change style of all <img> tags
body: <p>I am trying to simulate shaking by changing the position of img tags within a div.</p>
  <p>I have it working for one img at a time.</p>
  <p>Is there a way to change the style of all the img tags within a div at once?</p>
  <p>This is what I am currently doing:</p>
  <pre><code>bird = document.createElement('img');
  bird.setAttribute('src',birdie);
  bird.setAttribute('class', 'birdie');
  bird.setAttribute('id', id);
  bird.setAttribute('onLoad', 'shakeAll()');
  map.appendChild(bird);
  birds++;
  if(birdmap[0] == 0){
      birdmap = [id];
  }else{
      birdmap+=[,id];
  }
  </code></pre>
  <p>this <code>ShakeAll</code> function is also at <code>onLoad</code> of body:</p>
  <pre><code>function shakeAll(){
      if (birdmap[0] == 0) return;
      i = 1;
      while(i &lt;= birds){
          shakeIt(birdmap[i]);
          i++;
      }
  setTimeout(&quot;shakeAll()&quot;,initialSpeed);
  }
  </code></pre>
  <p>Note: the imgs are absolute</p>
  <pre><code>function shakeIt(id){
       shake = document.getElementById(id);
       j=1;
      while(j&lt;4){
       if (j==1){
        shake.style.top=parseInt(shake.style.top)+distance+&quot;px&quot;;
       }
       else if (j==2){
        shake.style.left=parseInt(shake.style.left)+distance+&quot;px&quot;;
       }
       else if (j==3){
        shake.style.top=parseInt(shake.style.top)-distance+&quot;px&quot;;
       }
       else{
        shake.style.left=parseInt(shake.style.left)-distance+&quot;px&quot;;
       }
       j++;
      
      }
       //setTimeout(&quot;shakeIt(id)&quot;, 50);
  }
  </code></pre>