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! :)
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! :)
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>
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.