[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-21-2006, 06:22 AM   #1 (permalink)
D@Z
NamePros Member
 
Join Date: Jun 2004
Location: United Kingdom
Posts: 165
94.00 NP$ (Donate)

D@Z is on a distinguished road


Text Size for Disabilities

I've seen a couple of website use images, where once clicked, you can increase or decrease the size of the text on the page, making it easier for users with disabilities, such as bad eyesight.

Can anyone point me in the right direction on how to do this? Like is it CSS, JavaScript or any free scripts? Thanks.
D@Z is offline  
Old 12-21-2006, 06:34 AM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future

Autism Autism Autism Autism Autism Autism Autism
textsizer.js:
Code:
/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)
	
	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on 
	their own website if, and only if, 
	this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'p','h1','h2','h3','h4');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}
The HTML:
Code:
In your <head>:
<script type="text/javascript" src="textsizer.js"></script>

In your <body>:
<a href="#" onclick="ts('body',1);" title="Make Text Larger">Larger Text</a>
<a href="#" onclick="ts('body',-1);" title="Make Text Smaller">Smaller Text</a>
Dan is offline  
Old 12-21-2006, 03:42 PM   #3 (permalink)
D@Z
NamePros Member
 
Join Date: Jun 2004
Location: United Kingdom
Posts: 165
94.00 NP$ (Donate)

D@Z is on a distinguished road


Great! Thanks, Dan. I will try this out soon when I have some spare time. On my stylesheet for my website my fonts are set to px, does this matter?
D@Z is offline  
Old 12-21-2006, 04:13 PM   #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future

Autism Autism Autism Autism Autism Autism Autism
Quote:
Originally Posted by D@Z
On my stylesheet for my website my fonts are set to px, does this matter?
I don't think so.

Last edited by Dan; 12-21-2006 at 04:25 PM.
Dan is offline  
Old 12-22-2006, 04:45 AM   #5 (permalink)
D@Z
NamePros Member
 
Join Date: Jun 2004
Location: United Kingdom
Posts: 165
94.00 NP$ (Donate)

D@Z is on a distinguished road


Ok, thanks for your help anyway. The script works great with my news articles.
D@Z is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 09:21 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85