title: move div using javascript
body: <p>I have a div and I am trying to move it right and left on page load using js to create a shaking movement.</p>
  
  <p>My code:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          obj = document.getElementById('hs');            
          obj.style.position='relative';  
          function goRight(){             
              obj.style.right = 10px;
              window.setTimeout(goLeft, 100);
          }
          function goLeft(){
              obj.style.left = 10px;
              window.setTimeout(goRight, 100);
          }
          window.onload =goRight;
      &lt;/script&gt;
  </code></pre>
  
  <p>But it doesn't work. The id of my div is <code>hs</code>.</p>
  
  <p>The html is:</p>
  
  <pre><code>            &lt;div id="hs"&gt;
          &lt;h1&gt;hs&lt;/h1&gt;
          &lt;hr&gt;
      &lt;/div&gt;&lt;
  </code></pre>