RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1705 | Replies: 1
Reply
Join Date: May 2005
Posts: 20
Reputation: jeepj27 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
jeepj27 jeepj27 is offline Offline
Newbie Poster

TEXT Enlarger Script?

  #1  
Jul 28th, 2007
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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,054
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 372
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: TEXT Enlarger Script?

  #2  
Jul 28th, 2007
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>
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:34 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC