title: How can i insert element inside dom correctly and something about setInterval
body: <p>i got a task that ask me to create a page, which can display a clock after </p>
  
  <p>the user click on the start button and stop when click the stop button</p>
  
  <p>The clock need to display inside a "span" tag because i need the DOM1 method.</p>
  
  <p>So my Code currently look's like this</p>
  
  <p>*I had already fix this. </p>
  
  <pre><code>function clock()
  {
  
  
  var obj = document.getElementById('clock');
  if (obj)
  {
  var now = new Date();
  var mytime = now.getHours()+":"+now.getMinutes()+"."+now.getSeconds();
  obj.innerHTML = mytime;
  
  }
  }
  
  
  
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body onload="clock()"&gt;
  &lt;table&gt;
  &lt;h1&gt;A live clock in JavaScript&lt;/h1&gt;
  
  &lt;p&gt;The time according to your PC is :&lt;span id="clock"&gt;&lt;/span&gt;&lt;/p&gt;
  
  
  
  
  &lt;input type="button" name="clickMe" value="Start the clock"
  onclick="timer = setInterval(clock, 1000)"/&gt;
  
  
  &lt;button onclick="window.clearInterval(timer)"&gt;Stop&lt;/button&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>