Tuesday, April 20, 2004

Let Them Eat Cake: A List Apart

Let Them Eat Cake: A List Apart - this is an article on making your web pages both accessible AND usable. For it to work you must have a well structured page, with links to various parts of the page at the top. Add in a bit of CSS and DOM compliant JavaScript and your done.

The good thing is it works with JavaScript disabled. The code is kept entirely separate from the content so you can have the page in XHTML Strict mode (no inline CSS or JavaScript, the example uses XHTML Strict). There is very little JavaScript involved. For those with older browser (IE4, Netscape 4), the user will just get the basic page - but as very few people use these browsers, most visitors will get the best experience.

Replace Notepad (Windows XP/2000 and later)

Edit - 30-Mar-2005: Fixed issues if backup version of notepad was in another folder, or SP2 was applied (C:\I386 or %windir%\ServicePackFiles\i386\)

The following batch script will allow you to replace notepad with a text edtor of your choice (will replace it for all users). Drag the file you wish to replace it with onto the batch script to do the replacement. You will probably get a warning about replacing a critical system file - you can ignore this. For it to work you need admin rights. To restore notepad, just double-click on the batch file. The use of this script is AT YOUR OWN RISK.

@echo off
REM This will replace Windows notepad with the program of your choice
REM The use of this script is AT YOUR OWN RISK.
REM filename to backup to
SET backupto=oldnotepad.exe
REM get file from parameter supplied
SET file=%1
REM if backup file exists, end the script
IF EXIST %windir%\system32\dllcache\%backupto% GOTO alreadyreplaced
REM If you do not specify a parameter, end the script
REM brackets are needed as spaces are ignored
IF (%file%) == () GOTO nofile
REM If source file does not exist, the replacement can not be made
IF NOT EXIST %file% GOTO nofile
attrib -r -h -s %windir%\system32\dllcache
ren %windir%\system32\dllcache\notepad.exe %backupto%
attrib +r +h +s %windir%\system32\dllcache
del %windir%\notepad.exe
copy /Y %file% %windir%\notepad.exe
del %windir%\system32\notepad.exe
copy /Y %file% %windir%\system32\notepad.exe
REM other folders that may contain notepad
IF EXIST C:\I386\notepad.exe ren C:\I386\notepad.exe %backupto%
IF EXIST %windir%\ServicePackFiles\i386\notepad.exe ren %windir%\ServicePackFiles\i386\notepad.exe %backupto%
GOTO end
:alreadyreplaced
attrib -r -h -s %windir%\system32\dllcache
ren %windir%\system32\dllcache\%backupto% notepad.exe
attrib +r +h +s %windir%\system32\dllcache
REM deleting the other notepad files will cause WFP to replace with the one in the dll cache
del %windir%\system32\notepad.exe
del %windir%\notepad.exe
REM other folders that may contain notepad
IF EXIST C:\I386\%backupto% ren C:\I386\%backupto% notepad.exe
IF EXIST %windir%\ServicePackFiles\i386\%backupto% ren %windir%\ServicePackFiles\i386\%backupto% notepad.exe
echo ------------------------------------------------------
echo  Notepad has already been replaced, original restored
echo ------------------------------------------------------
GOTO end
:nofile
echo ----------------------------------------------------
echo  You did not specify a file, or file does not exist
echo ----------------------------------------------------
:end

Tested on Windows XP - but should work on 2000. May not work on Windows 95/98/ME.


Tags: ,

Left Align Captions in Firefox

In Firefox (and other Mozilla browsers I presume) when you try <caption align="left">caption aligned</caption> it does not behave as expected - the table contents is shifted to the right of the caption. To fix this the following CSS is used:

caption.left {
 text-align: left;
 caption-side: top;
 width: 100%;
}

To use on the page, the HTML code becomes this:

<caption align="left" class="left">caption aligned</caption>

However, using the following CSS is a better method (ignored by IE), as you do not need to change your HTML code:

caption[align="left"] {
 text-align: left;
 caption-side: top;
 width: 100%;
}

Friday, April 16, 2004

The Table Ruler: A List Apart

The Table Ruler: A List Apart - an interesting effect for tables using the DOM and CSS. When you mouseover a table row it gets highlighted, thus making it easier to read. Any W3c DOM 1 compliant browser should be able to use this effect.

Web Accessibility and UK Law: Telling It Like It Is: A List Apart

Web Accessibility and UK Law: Telling It Like It Is: A List Apart - the law in the UK means websites have to be accessible. Many websites do not comply with this and neither does the code generated by ASP.NET controls - mainly the DataGrid control. A hotfix is available, but you need to contact Microsoft to obtain it. Unless they allow you to download it, we will have to wait until .NET 1.2 (or is is 2.0?) comes out. Even with the hotfix I don't think DataGrids are completely accessible - you need JavaScript enabled to page the DataGrid.

Power To The People: Relative Font Sizes: A List Apart

Power To The People: Relative Font Sizes: A List Apart - this article outlines a way to use relative font sizes in web pages, while respecting the users ability to resize their font using the in built browser controls. It also allows the user to resize text on the page using buttons and JavaScript.