0

Hi To All -

Is anyone aware of how, or if there is a script available that I can use to have a + or - button on each page of my site that will allow visually impaired visitors to ENLARGE THE TEXT on that page?

Thanks for anyone's time/help! :)

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by ~s.o.s~
0

A simple script like this should do the job:

<html>
<head>
    <script>
    var INIT_SZ, MAX, MIN;
    
    var init = function()
    {
        INIT_SZ = 14;
        MAX = 24;
        MIN = 10;
        var elem = document.getElementsByTagName('body');
        elem[0].style.fontSize = 14;
        alert(elem[0].style.fontSize);
    }
    
    var enlarge = function()
    {    
        var elem = document.getElementsByTagName('body');
        var size = parseInt(elem[0].style.fontSize.replace("px", ""));
        if(size < MAX)
        {
            elem[0].style.fontSize = (size + 1) + "px";
        }
    }
    
    var shrink = function()
    {    
        var elem = document.getElementsByTagName('body');
        var size = parseInt(elem[0].style.fontSize.replace("px", ""));
        if(size > MIN)
        {
            elem[0].style.fontSize = (size - 1) + "px";
        }
    }
    </script>
</head>
<body onload="init();">
    <p>hello to all</p>
    <br />
    <input type="button" value="+" onclick="enlarge();" /><br />
    <input type="button" value="- " onclick="shrink();" />
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.