How to Change Font Size onClick using JavaScript

add this script in your header:

<script type="text/javascript">
function textResize(text) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "1.0em";
  }
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (text * 0.2) + "em";
}</script>

Then add this code anywhere in your body:

<a href="javascript:void(0);" onclick="textResize(1)">Make text bigger</a> | <a href="javascript:void(0);" onclick="resizeText(-1)">Make text smaller</a>

Hi, Stranger! Leave Your Comment...

Name (required)
Email (required)
Website