HTML and CSS Reference
In-Depth Information
window.onunload = function(e) {
var title = getActiveTheme();
createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredTheme();
setActiveTheme(title);
Finally, we put all the components together and get the style switcher functionality on our site (Listing 10-13).
Listing 10-13. The Markup Code Featuring the Style Switcher
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<title>Style switcher demo</title>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="styles/main.css" />
<link rel="stylesheet" type="text/css" href="styles/main.css" title="Preferred" />
<link rel="alternate stylesheet" type="text/css" href="styles/large.css" title="Large" />
<link rel="alternate stylesheet" type="text/css" href="styles/contrast.css"
title="Contrast" />
<script type="text/javascript" src="scripts/styleswitcher.js"></script>
</head>
<body>
<div id="wrapper">
<h1>Style switcher demo</h1>
<p>This is the content.</p>
<div id="colorswitch">
<a href="javascript:void(0);" onclick="javascript:setActiveTheme('Preferred');
return false;" id="default">Default CSS</a>
<a href="javascript:void(0);" onclick="javascript:setActiveTheme('Large');
return false;" id="larger">Large fonts</a>
<a href="javascript:void(0);" onclick="javascript:setActiveTheme('Contrast');
return false;" id="contrast">High contrast</a>
</div>
</div>
</body>
</html>
Content scrolled with scripts, such as banners, must have a mechanism to pause or stop scrolling.
Web pages that apply image replacement for text fragments from CSS should have an interface that allows users
to switch between the two versions.
Web content structure should contain proper semantic markup elements. The elements must be used according
to their meaning rather than their (default) appearance. Semantically meaningful markup such as em or strong must
be used for emphasized and special texts. The ol , ul , and dl elements must be applied for both lists and link groups.
Links must be grouped using the map element.
Keyboard users must not be stopped by a web site section accessible exclusively with a mouse. The same holds
for Flash objects that are not keyboard accessible by default.
 
Search WWH ::




Custom Search