title: How can I dynamically increase font size with Javascript and why is my current function not working?
body: <p>I'm trying to increase the font size of my page using a javascript function but it's not working. Is there a syntax problem with my code or is it not possible to do what I'm trying to do?  </p>
  
  <p>Javascript:</p>
  
  <pre><code>function changeFontSize(fontvar) {
  var div = document.getElementById("webchat_history");
  var currentFont = div.style.fontSize.value;
  
  div.style.fontSize = currentFont + fontvar+ "px";
  }
  </code></pre>
  
  <p>HTML:<br>
      <code>&lt;span onClick="changeFontSize(10);" style="font-size:16px;"&gt;Aa&lt;/span&gt;</code></p>
  
  <p>I want to increase it by x amount (fontvar) rather than specifying a specific font size because my font sizes are set in an external stylesheet. When/if I need to modify the stylesheets, I'd rather not have to update the Javascript too. </p>