We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2401
    • 17 Posts
    I’m doing a website for my local community - some of who are visually impaired. I have seen on some web sites where the user (ie th eperson reading the site) can select the font size (small / medium / large). I was wondering if anyone knew how to implement this?

    Thanks
    A.
      • 25490
      • 5 Posts
      You could do this:
      Create a CHUNK with this in it:
      <input type="button" onclick="smaller()" value="smaller" name="Smaller" />
      <input type="button" onclick="larger()" value="LARGER" name="Larger" />
      <script type="text/javascript">
      function smaller() {
      el = document.getElementById("body");
      scale = 1/1.2;
      size = parseFloat(el.style.fontSize) * scale;
      if (size>1000 || isNaN(size)) size=100;
      el.style.fontSize = size + "%";
      }
      function larger() {
      el = document.getElementById("body");
      scale = 1.2;
      size = parseFloat(el.style.fontSize) * scale;
      if (size<10 || isNaN(size)) size=100;
      el.style.fontSize = size + "%";
      }
      </script>

      Create a template with these lines in it:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      …
      <body id="body" style="font-size: 100%">


      I am not sure why, but I found that some pages I had needed the "http://www.w3.org/TR/html4/loose.dtd" portion added to the DOCTYPE. I think it may be only because they were not well form.

      Then place a reference to the CHUNK you created either in your template or your document.

      Note:
      Images will not be resized.
      Sections of your page will NOT resize if they use the likes of:
      <font face="Arial, Helvetica" size="-2">
      Where as sections of your page will resize if they use the likes of:
      <font face="Arial, Helvetica"><small><small>

      You may also want to check up how those other sites, that you referred to, accomplish the task. Perhaps you could email their webmaster to find out.

      Best of luck, Ron
        • 2401
        • 17 Posts
        Thanks for the info, very remiss of me not to have thanked before.