title: How can I dynamically move a button on an HTML page?
body: <p>I’ve gone through the 1st 5,625 questions in the HTML section of the Stack Overflow website &amp; I didn’t find any questions that seem to match my particular problem.</p>
  
  <p>I have a button that I’ve placed on a web page using absolute positioning. I need to dynamically move that button to another location. So for example let’s ay the initial x &amp; y co-ordinates of the button are 8 &amp; 16 and in this instance I need to move it to say a position with x &amp; y co-ordinates of 64 &amp; 128.</p>
  
  <p>I can find the position of the button by doing this :</p>
  
  <pre><code>the_Old_Button_X_Offset = document.getElementById 
  (theButtonID).offsetParent.offsetLeft;
  
  the_Old_Button_Y_Offset = document.getElementById
   (theButtonID).offsetParent.offsetTop ;
  </code></pre>
  
  <p>This will give me the x &amp; y co-ordinates of 8 &amp; 16. But when I try to reset the x&amp; y co-ordinates of the button by doing this :</p>
  
  <pre><code>document.getElementById (theButtonID).offsetParent.offsetLeft = 64;
  document.getElementById (theButtonID).offsetParent.offsetTop  = 128;
  </code></pre>
  
  <p>The values for “offsetParent.offsetLeft” &amp; “offsetParent.offsetLeft” are still 8 &amp; 16 &amp; NOT 64 &amp; 128. So obviously, I’m both doing something wrong &amp; I’m not understanding something I should understand.</p>
  
  <p>So what am I doing wrong? What is it that I’m missing? And Most importantly, how do I dynamically move a button from 1 location on a web page to another.</p>
  
  <p>Thank for all your help &amp; suggestions.</p>