<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ProgramimiCOM &#187; HTML</title>
	<atom:link href="http://www.programimi.com/category/tutorials/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.programimi.com</link>
	<description>Programming And Web Resources</description>
	<lastBuildDate>Sat, 20 Mar 2010 12:00:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Web Standards Checklist &#8211; How to make a proper website</title>
		<link>http://www.programimi.com/2008/04/03/a-web-standards-checklist-how-to-make-a-proper-website/</link>
		<comments>http://www.programimi.com/2008/04/03/a-web-standards-checklist-how-to-make-a-proper-website/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 11:14:51 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Authoring]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web standarts]]></category>

		<guid isPermaLink="false">http://www.programimi.com/?p=983</guid>
		<description><![CDATA[

A web standards checklist
The term web standards can mean different things to different people. For some, it is &#8216;table-free sites&#8217;, for others it is &#8216;using valid code&#8217;. However, web standards are much broader than that. A site built to web standards should adhere to standards (HTML, XHTML, XML, CSS, XSLT, DOM, MathML, SVG etc) and [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><strong>A web standards checklist</strong></p>
<p>The term web standards can mean different things to different people. For some, it is &#8216;table-free sites&#8217;, for others it is &#8216;using valid code&#8217;. However, web standards are much broader than that. A site built to web standards should adhere to standards (HTML, XHTML, XML, CSS, XSLT, DOM, MathML, SVG etc) and pursue best practices (valid code, accessible code, semantically correct code, user-friendly URLs etc).</p>
<p>In other words, a site built to web standards should ideally be lean, clean, CSS-based, accessible, usable and search engine friendly.</p>
<p><strong>About the checklist</strong></p>
<p>This is not an uber-checklist. There are probably many items that could be added. More importantly, it should not be seen as a list of items that must be addressed on every site that you develop. It is simply a guide that can be used:</p>
<p>- to show the breadth of web standards<br />
- as a handy tool for developers during the production phase of websites<br />
- as an aid for developers who are interested in moving towards web standards</p>
<p><strong>The checklist</strong></p>
<p><strong>1.Quality of code</strong><br />
a. Does the site use a correct Doctype?<br />
b. Does the site use a Character set?<br />
c. Does the site use Valid (X)HTML?<br />
d. Does the site use Valid CSS?<br />
e. Does the site use any CSS hacks?<br />
f. Does the site use unnecessary classes or ids?<br />
g. Is the code well structured?<br />
h. Does the site have any broken links?<br />
i. How does the site perform in terms of speed/page size?<br />
j. Does the site have JavaScript errors?</p>
<p><strong>2. Degree of separation between content and presentation</strong><br />
a. Does the site use CSS for all presentation aspects (fonts, colour, padding, borders etc)?<br />
b. Are all decorative images in the CSS, or do they appear in the (X)HTML?</p>
<p><strong>3. Accessibility for users</strong><br />
a. Are &#8220;alt&#8221; attributes used for all descriptive images?<br />
b. Does the site use relative units rather than absolute units for text size?<br />
c. Do any aspects of the layout break if font size is increased?<br />
d. Does the site use visible skip menus?<br />
e. Does the site use accessible forms?<br />
f. Does the site use accessible tables?<br />
g. Is there sufficient colour brightness/contrasts?<br />
h. Is colour alone used for critical information?<br />
i. Is there delayed responsiveness for dropdown menus (for users with reduced motor skills)?<br />
j. Are all links descriptive (for blind users)?</p>
<p><strong>4. Accessibility for devices</strong><br />
a. Does the site work acceptably across modern and older browsers?<br />
b. Is the content accessible with CSS switched off or not supported?<br />
c. Is the content accessible with images switched off or not supported?<br />
d. Does the site work in text browsers such as Lynx?<br />
e. Does the site work well when printed?<br />
f. Does the site work well in Hand Held devices?<br />
g. Does the site include detailed metadata?<br />
h. Does the site work well in a range of browser window sizes?</p>
<p><strong>5. Basic Usability</strong><br />
a. Is there a clear visual hierarchy?<br />
b. Are heading levels easy to distinguish?<br />
c. Does the site have easy to understand navigation?<br />
d. Does the site use consistent navigation?<br />
e. Are links underlined?<br />
f. Does the site use consistent and appropriate language?<br />
g. Do you have a sitemap page and contact page? Are they easy to find?<br />
h. For large sites, is there a search tool?<br />
i. Is there a link to the home page on every page in the site?<br />
j. Are visited links clearly defined with a unique colour?</p>
<p><strong>6. Site management</strong><br />
a. Does the site have a meaningful and helpful 404 error page that works from any depth in the site?<br />
b. Does the site use friendly URLs?<br />
c. Do your URLs work without &#8220;www&#8221;?<br />
d. Does the site have a favicon?</p>
<p><strong>1. Quality of code</strong></p>
<p><strong>1.1 Does the site use a correct Doctype?</strong><br />
A doctype (short for &#8216;document type declaration&#8217;) informs the validator which version of (X)HTML you&#8217;re using, and must appear at the very top of every web page. Doctypes are a key component of compliant web pages: your markup and CSS won&#8217;t validate without them.</p>
<p><code>http://www.alistapart.com/articles/doctype/</code></p>
<p><em>More:</em></p>
<p><code>http://www.w3.org/QA/2002/04/valid-dtd-list.html</code></p>
<p><code>http://css.maxdesign.com.au/listamatic/about-boxmodel.htm</code></p>
<p><code>http://gutfeldt.ch/matthias/articles/doctypeswitch.html</code></p>
<p><strong>1.2 Does the site use a Character set?</strong><br />
If a user agent (eg. a browser) is unable to detect the character encoding used in a Web document, the user may be presented with unreadable text. This information is particularly important for those maintaining and extending a multilingual site, but declaring the character encoding of the document is important for anyone producing XHTML/HTML or CSS.</p>
<p><code>http://www.w3.org/International/tutorials/tutorial-char-enc/</code></p>
<p><em>More:</em></p>
<p><code>http://www.w3.org/International/O-charset.html</code></p>
<p><strong>1.3 Does the site use Valid (X)HTML?</strong><br />
Valid code will render faster than code with errors. Valid code will render better than invalid code. Browsers are becoming more standards compliant, and it is becoming increasingly necessary to write valid and standards compliant HTML.</p>
<p><code>http://www.maxdesign.com.au/presentation/sit2003/06.htm</code></p>
<p><em>More:</em></p>
<p><code>http://validator.w3.org/</code></p>
<p><strong>1.4 Does the site use Valid CSS?</strong><br />
You need to make sure that there aren&#8217;t any errors in either your HTML or your CSS, since mistakes in either place can result in botched document appearance.</p>
<p><code>http://www.meyerweb.com/eric/articles/webrev/199904.html</code></p>
<p><em>More:</em></p>
<p><code>http://jigsaw.w3.org/css-validator/</code></p>
<p><strong>1.5 Does the site use any CSS hacks?</strong><br />
Basically, hacks come down to personal choice, the amount of knowledge you have of workarounds, the specific design you are trying to achieve.</p>
<p><code>http://www.mail-archive.com/wsg@webstandardsgroup.org/msg05823.html</code></p>
<p><em>More:</em></p>
<p><code>http://css-discuss.incutio.com/?page=CssHack</code></p>
<p><code>http://css-discuss.incutio.com/?page=ToHackOrNotToHack</code></p>
<p><code>http://centricle.com/ref/css/filters/</code></p>
<p><strong>1.6 Does the site use unnecessary classes or ids?</strong><br />
I&#8217;ve noticed that developers learning new skills often end up with good CSS but poor XHTML. Specifically, the HTML code tends to be full of unnecessary divs and ids. This results in fairly meaningless HTML and bloated style sheets.</p>
<p><code>http://www.clagnut.com/blog/228/</code></p>
<p><strong>1.7 Is the code well structured?</strong><br />
Semantically correct markup uses html elements for their given purpose. Well structured HTML has semantic meaning for a wide range of user agents (browsers without style sheets, text browsers, PDAs, search engines etc.)</p>
<p><code>http://www.maxdesign.com.au/presentation/benefits/index04.htm</code></p>
<p><em>More:</em></p>
<p><code>http://www.w3.org/2003/12/semantic-extractor.html</code></p>
<p><strong>1.8 Does the site have any broken links?</strong><br />
Broken links can frustrate users and potentially drive customers away. Broken links can also keep search engines from properly indexing your site.</p>
<p><em>More:</em></p>
<p><code>http://validator.w3.org/checklink</code></p>
<p><strong>1.9 How does the site perform in terms of speed/page size?</strong><br />
Don&#8217;t make me wait&#8230; That&#8217;s the message users give us in survey after survey. Even broadband users can suffer the slow-loading blues.</p>
<p><code>http://www.websiteoptimization.com/speed/</code></p>
<p><strong>1.10 Does the site have JavaScript errors?</strong><br />
Internet Explore for Windows allows you to turn on a debugger that will pop up a new window and let you know there are javascript errors on your site. This is available under &#8216;Internet Options&#8217; on the Advanced tab. Uncheck &#8216;Disable script debugging&#8217;.</p>
<p><strong>2. Degree of separation between content and presentation</strong></p>
<p><strong>2.1 Does the site use CSS for all presentation aspects (fonts, colour, padding, borders etc)?</strong><br />
Use style sheets to control layout and presentation.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-style-sheets</code></p>
<p><strong>2.2 Are all decorative images in the CSS, or do they appear in the (X)HTML?</strong><br />
The aim for web developers is to remove all presentation from the html code, leaving it clean and semantically correct.</p>
<p><code>http://www.maxdesign.com.au/presentation/benefits/index07.htm</code></p>
<p><strong>3. Accessibility for users</strong></p>
<p><strong>3.1 Are &#8220;alt&#8221; attributes used for all descriptive images?</strong><br />
Provide a text equivalent for every non-text element</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-text-equivalent</code></p>
<p><strong>3.2 Does the site use relative units rather than absolute units for text size?</strong><br />
Use relative rather than absolute units in markup language attribute values and style sheet property values&#8217;.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-relative-units</code></p>
<p><em>More:</em></p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-relative-units</code></p>
<p><code>http://www.clagnut.com/blog/348/</code></p>
<p><strong>3.3 Do any aspects of the layout break if font size is increased?</strong><br />
Try this simple test. Look at your website in a browser that supports easy incrementation of font size. Now increase your browser&#8217;s font size. And again. And again&#8230; Look at your site. Does the page layout still hold together? It is dangerous for developers to assume that everyone browses using default font sizes.</p>
<p><strong> 3.4 Does the site use visible skip menus?</strong></p>
<p>A method shall be provided that permits users to skip repetitive navigation links.</p>
<p><code>http://www.section508.gov/index.cfm?FuseAction=Content&amp;ID=12</code></p>
<p>Group related links, identify the group (for user agents), and, until user agents do so, provide a way to bypass the group.</p>
<p><code>http://www.w3.org/TR/WCAG10-TECHS/#tech-group-links</code></p>
<p>&#8230;blind visitors are not the only ones inconvenienced by too many links in a navigation area. Recall that a mobility-impaired person with poor adaptive technology might be stuck tabbing through that morass.</p>
<p><code>http://joeclark.org/book/sashay/serialization/Chapter08.html#h4-2020</code></p>
<p><em>More:</em></p>
<p><code>http://www.niehs.nih.gov/websmith/508/o.htm</code></p>
<p><strong>3.5 Does the site use accessible forms?</strong><br />
Forms aren&#8217;t the easiest of things to use for people with disabilities. Navigating around a page with written content is one thing, hopping between form fields and inputting information is another.</p>
<p><code>http://www.htmldog.com/guides/htmladvanced/forms/</code></p>
<p><em>More:</em></p>
<p><code>http://www.webstandards.org/learn/tutorials/accessible-forms/01-accessible-forms.html</code></p>
<p><code>http://www.accessify.com/tools-and-wizards/accessible-form-builder.asp</code></p>
<p><code>http://accessify.com/tutorials/better-accessible-forms.asp</code></p>
<p><strong>3.6 Does the site use accessible tables?</strong><br />
For data tables, identify row and column headers&#8230; For data tables that have two or more logical levels of row or column headers, use markup to associate data cells and header cells.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-table-headers</code></p>
<p><em>More:</em></p>
<p><code>http://www.bcc.ctc.edu/webpublishing/ada/resources/tables.asp</code></p>
<p><code>http://www.accessify.com/tools-and-wizards/accessible-table-builder_step1.asp</code></p>
<p><code>http://www.webaim.org/techniques/tables/</code></p>
<p><strong>3.7 Is there sufficient colour brightness/contrasts?</strong><br />
Ensure that foreground and background colour combinations provide sufficient contrast when viewed by someone having colour deficits.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-colour-contrast</code></p>
<p><em>More:</em></p>
<p><code>http://www.juicystudio.com/services/colourcontrast.asp</code></p>
<p><strong>3.8 Is colour alone used for critical information?</strong><br />
Ensure that all information conveyed with colour is also available without colour, for example from context or markup.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-colour-convey</code></p>
<p>There are basically three types of colour deficiency; Deuteranope (a form of red/green colour deficit), Protanope (another form of red/green colour deficit) and Tritanope (a blue/yellow deficit- very rare).</p>
<p><em>More:</em></p>
<p><code>http://colourfilter.wickline.org/</code></p>
<p><code>http://www.toledo-bend.com/colourblind/Ishihara.html</code></p>
<p><code>http://www.vischeck.com/vischeck/vischeckURL.php</code></p>
<p><strong>3.9 Is there delayed responsiveness for dropdown menus?</strong><br />
Users with reduced motor skills may find dropdown menus hard to use if responsiveness is set too fast.</p>
<p><strong>3.10 Are all links descriptive?</strong><br />
Link text should be meaningful enough to make sense when read out of context &#8211; either on its own or as part of a sequence of links. Link text should also be terse.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-meaningful-links</code></p>
<p><strong>4. Accessibility for devices.</strong></p>
<p><strong>4.1 Does the site work acceptably across modern and older browsers?</strong></p>
<p>Before starting to build a CSS-based layout, you should decide which browsers to support and to what level you intend to support them.</p>
<p><code>http://www.maxdesign.com.au/presentation/process/index_step01.cfm</code></p>
<p><strong>4.2 Is the content accessible with CSS switched off or not supported?</strong><br />
Some people may visit your site with either a browser that does not support CSS or a browser with CSS switched off. In content is structured well, this will not be an issue.</p>
<p><strong>4.3 Is the content accessible with images switched off or not supported?</strong><br />
Some people browse websites with images switched off &#8211; especially people on very slow connections. Content should still be accessible for these people.</p>
<p><strong>4.4 Does the site work in text browsers such as Lynx?</strong><br />
This is like a combination of images and CSS switched off. A text-based browser will rely on well structured content to provide meaning.</p>
<p><em>More:</em></p>
<p><code>http://www.delorie.com/web/lynxview</code></p>
<p><strong>4.5 Does the site work well when printed?</strong><br />
You can take any (X)HTML document and simply style it for print, without having to touch the markup.</p>
<p><code>http://www.alistapart.com/articles/goingtoprint/</code></p>
<p><em>More:</em></p>
<p><code>http://www.d.umn.edu/itss/support/Training/Online/webdesign/css.html#print</code></p>
<p><strong>4.6 Does the site work well in Hand Held devices?</strong><br />
This is a hard one to deal with until hand held devices consistently support their correct media type. However, some layouts work better in current hand-held devices. The importance of supporting hand held devices will depend on target audiences.</p>
<p><strong>4.7 Does the site include detailed metadata?</strong><br />
Metadata is machine understandable information for the web</p>
<p><code>http://www.w3.org/Metadata/</code></p>
<p>Metadata is structured information that is created specifically to describe another resource. In other words, metadata is &#8216;data about data&#8217;.</p>
<p><strong>4.8 Does the site work well in a range of browser window sizes?</strong><br />
It is a common assumption amongst developers that average screen sizes are increasing. Some developers assume that the average screen size is now 1024px wide. But what about users with smaller screens and users with hand held devices? Are they part of your target audience and are they being disadvantaged?</p>
<p><strong>5. Basic Usability</strong><br />
<strong> 5.1 Is there a clear visual hierarchy?</strong><br />
Organise and prioritise the contents of a page by using size, prominence and content relationships.</p>
<p><code>http://www.great-web-design-tips.com/web-site-design/165.html</code></p>
<p><strong>5.2 Are heading levels easy to distinguish?</strong><br />
Use header elements to convey document structure and use them according to specification.</p>
<p><code>http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-logical-headings</code></p>
<p><strong>5.3 Is the site&#8217;s navigation easy to understand?</strong><br />
Your navigation system should give your visitor a clue as to what page of the site they are currently on and where they can go next.</p>
<p><code>http://www.1stsitefree.com/design_nav.htm</code></p>
<p><strong>5.4 Is the site&#8217;s navigation consistent?</strong><br />
If each page on your site has a consistent style of presentation, visitors will find it easier to navigate between pages and find information</p>
<p><code>http://www.juicystudio.com/tutorial/accessibility/navigation.asp</code></p>
<p><strong>5.5 Does the site use consistent and appropriate language?</strong><br />
The use of clear and simple language promotes effective communication. Trying to come across as articulate can be as difficult to read as poorly written grammar, especially if the language used isn&#8217;t the visitor&#8217;s primary language.</p>
<p><code>http://www.juicystudio.com/tutorial/accessibility/clear.asp</code></p>
<p><strong>5.6 Does the site have a sitemap page and contact page? Are they easy to find?</strong><br />
Most site maps fail to convey multiple levels of the site&#8217;s information architecture. In usability tests, users often overlook site maps or can&#8217;t find them. Complexity is also a problem: a map should be a map, not a navigational challenge of its own.</p>
<p><code>http://www.useit.com/alertbox/20020106.html</code></p>
<p><strong>5.7 For large sites, is there a search tool?</strong><br />
While search tools are not needed on smaller sites, and some people will not ever use them, site-specific search tools allow users a choice of navigation options.</p>
<p><strong>5.8 Is there a link to the home page on every page in the site?</strong><br />
Some users like to go back to a site&#8217;s home page after navigating to content within a site. The home page becomes a base camp for these users, allowing them to regroup before exploring new content.</p>
<p><strong>5.9 Are links underlined?</strong><br />
To maximise the perceived affordance of clickability, colour and underline the link text. Users shouldn&#8217;t have to guess or scrub the page to find out where they can click.</p>
<p><code>http://www.useit.com/alertbox/20040510.html</code></p>
<p><strong>5.10 Are visited links clearly defined?</strong><br />
Most important, knowing which pages they&#8217;ve already visited frees users from unintentionally revisiting the same pages over and over again.</p>
<p><code>http://www.useit.com/alertbox/20040503.html</code></p>
<p><strong>6. Site management</strong></p>
<p><strong>6.1 Does the site have a meaningful and helpful 404 error page that works from any depth in the site?</strong><br />
You&#8217;ve requested a page &#8211; either by typing a URL directly into the address bar or clicking on an out-of-date link and you&#8217;ve found yourself in the middle of cyberspace nowhere. A user-friendly website will give you a helping hand while many others will simply do nothing, relying on the browser&#8217;s built-in ability to explain what the problem is.</p>
<p><code>http://www.alistapart.com/articles/perfect404/</code></p>
<p><strong>6.2 Does the site use friendly URLs?</strong><br />
Most search engines (with a few exceptions &#8211; namely Google) will not index any pages that have a question mark or other character (like an ampersand or equals sign) in the URL&#8230; what good is a site if no one can find it?</p>
<p><code>http://www.sitepoint.com/article/search-engine-friendly-urls</code></p>
<p>One of the worst elements of the web from a user interface standpoint is the URL. However, if they&#8217;re short, logical, and self-correcting, URLs can be acceptably usable</p>
<p><code>http://www.merges.net/theory/20010305.html</code></p>
<p><em>More:</em></p>
<p><code>http://www.sitepoint.com/article/search-engine-friendly-urls</code></p>
<p><code>http://www.websitegoodies.com/article/32</code></p>
<p><code>http://www.merges.net/theory/20010305.html</code></p>
<p><strong>6.3 Does the site&#8217;s URL work without &#8220;www&#8221;?</strong><br />
While this is not critical, and in some cases is not even possible, it is always good to give people the choice of both options. If a user types your domain name without the www and gets no site, this could disadvantage both the user and you.</p>
<p><strong> 6.4 Does the site have a favicon?</strong></p>
<p>A Favicon is a multi-resolution image included on nearly all professionally developed sites. The Favicon allows the webmaster to further promote their site, and to create a more customized appearance within a visitor&#8217;s browser.</p>
<p><code>http://www.favicon.com/</code></p>
<p>Favicons are definitely not critical. However, if they are not present, they can cause 404 errors in your logs (site statistics). Browsers like IE will request them from the server when a site is bookmarked. If a favicon isn&#8217;t available, a 404 error may be generated. Therefore, having a favicon could cut down on favicon specific 404 errors. The same is true of a &#8216;robots.txt&#8217; file.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2008/04/03/a-web-standards-checklist-how-to-make-a-proper-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Web Page Fonts Consistent and Uniform</title>
		<link>http://www.programimi.com/2008/03/24/making-web-page-fonts-consistent-and-uniform/</link>
		<comments>http://www.programimi.com/2008/03/24/making-web-page-fonts-consistent-and-uniform/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 09:37:25 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Authoring]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[big]]></category>
		<category><![CDATA[consistent]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[small]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[uniform]]></category>
		<category><![CDATA[WEB]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2008/03/24/making-web-page-fonts-consistent-and-uniform/</guid>
		<description><![CDATA[

Is it disturbing to you when every other Web page you visit has a different font size?. One web page&#8217;s font is too small, and another web page&#8217;s fonts are too big&#8230; Well here&#8217;s a way to fix that and set each web page&#8217;s fonts to just the size you want.
In Internet Explorer, select: Tools-Internet [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p>Is it disturbing to you when every other Web page you visit has a different font size?. One web page&#8217;s font is too small, and another web page&#8217;s fonts are too big&#8230; Well here&#8217;s a way to fix that and set each web page&#8217;s fonts to just the size you want.</p>
<p>In Internet Explorer, select: Tools-Internet Options, choose the General tab, click the Accessibility button, and check Ignore font sizes specified on Web pages (the wording varies depending on your IE version).</p>
<p>In Netscape 6 and 7, choose Edit-Preferences, select Fonts (double-click Appearance if you don&#8217;t see &#8216;Fonts&#8217; listed), and then either check Use my default fonts or uncheck Allow documents to use other fonts, depending on your version (the wording of these choices also varies).</p>
<p>Now all Web page fonts should be of uniform size on all pages.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2008/03/24/making-web-page-fonts-consistent-and-uniform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>55 Reasons to Design in XHTML-CSS</title>
		<link>http://www.programimi.com/2007/09/14/55-reasons-to-design-in-xhtml-css/</link>
		<comments>http://www.programimi.com/2007/09/14/55-reasons-to-design-in-xhtml-css/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 23:00:59 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/14/55-reasons-to-design-in-xhtml-css/</guid>
		<description><![CDATA[

In no particular order 55 reasons for me to do “tableless” websites using valid XHTML for markup, CSS for layout and Flash sparingly, only as an ingredient. By tableless I mean avoiding tables (or a tagsoup of unnecessary divs substituting table trs and tds) for layout purposes and aiming towards as semantic markup as possible. [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">In no particular order 55 reasons for me to do “tableless” websites using valid XHTML for markup, CSS for layout and Flash sparingly, only as an ingredient. By tableless I mean avoiding tables (or a tagsoup of unnecessary divs substituting table trs and tds) for layout purposes and aiming towards as semantic markup as possible. Some of the reasons are “over HTML&#8221;, some “over Flash full monty” and some over both. <o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">I know this topic has been discussed a plenty, I just needed to reaffirm myself :)</p>
<p>Here we go:<o:p></o:p></span></p>
<ol start="1" type="1">
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can get free links from      showcase sites like </span><span style="font-size: 10pt"><a href="http://www.csszengarden.com/"><span style="color: blue">zengarden</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.stylegala.com/"><span style="color: blue">stylegala</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.cssimport.com/"><span style="color: blue">cssimport</span></a></span><span style="font-size: 10pt"> or </span><span style="font-size: 10pt"><a href="http://www.cssbeauty.com/"><span style="color: blue">cssbeauty</span></a></span><span style="font-size: 10pt"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You don’t have to spend extra      thought and time deciding on styling the mark up of your document (upper-      or lowercase, quotes or no quotes on attributes)<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You don’t need to spend extra      thought on which tags should be closed and which can (or should) be left open<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You “help” the search engines to      deliver more relevant content using semantic markup<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can save in bandwidth costs      and visitors will see them faster by making slimmer pages<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">It’s going to be easier for you to      switch to XHTML 2.0 which will give you more semantic tools<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Once you’ve practised enough,      coding pages becomes a whole lot simpler and faster than any table/tr/td      tagsoup<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">When the coding is faster you can      spend more time on thinking about the user experience<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Thinking about semantics of a      document helps you to make design and information architecture decisions<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can quickly make a dummy site      to test your sites information architecture and append a look and feel      later with only minor code changes<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can do the design after most      of the backend is done which will help your client (or boss) to think      realistically about how much work is still needed<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">It’s possible to link directly to      your content pages (compared to Flash)<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">browser controls like text-size      and back and forward buttons work (compared to Flash)<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Redesigns and realigns over the      whole site are simpler<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">it’s simpler to make small last      minute changes to your designs<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Clean markup makes it easier or      even unnecessary to build a CMS<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Clean markup makes it easier for      another developer to jump on board<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can make the backend almost      totally independently from the frontend design, by completely different      person<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You have plenty of ways to play      with the markup trying to optimize for search engines, without affecting      visible layout<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You have total control on print      layouts of your pages<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Your sites are automatically      accessible to all kinds of browsers<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Promoting web standards will help      your work in the future, not having to code differently to each browser<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">With all elemets closed you mark      up look cleaner<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Well-formed code ensures your site      works in more browsers<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Well-formed code would help      browser coders to spend more time on useful features than rendering      engines that try to understand borken code<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Your website will work in future      browsers<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Your website works in mobile (and      other new) devices<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You learn the basics of XML which      has many other uses<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">CSS files are saved in browser      cache for fast retrieval and less bandwidth use<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Your documents are easy to convert      back and forth another format using XSLT<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Thinking semantics makes you think      more about the content<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Learning semantics makes you      appreciate organization and write your other documents (even emails) in      more organized way<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can write new technologies in      your CV or portfolio<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Modern browsers render a valid document      faster<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You feel better about yourself      when you are making sites “the right way”<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">They are doing it: </span><span style="font-size: 10pt"><a href="http://www.simplebits.com/"><span style="color: blue">Dan Cederholm</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.zeldman.com/"><span style="color: blue">Jeffrey      Zeldman</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.jasonsantamaria.com/"><span style="color: blue">Jason Santa Maria</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.shauninman.com/"><span style="color: blue">Shaun      Inman</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.cameronmoll.com/"><span style="color: blue">Cameron Moll</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.stopdesign.com/"><span style="color: blue">Douglas      Bowman</span></a></span><span style="font-size: 10pt">, </span><span style="font-size: 10pt"><a href="http://www.mezzoblue.com/"><span style="color: blue">Dave Shea</span></a></span><span style="font-size: 10pt">…<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You will belong in a      “movement&#8221;, make good contacts etc.<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You learn to appreciate newer      browsers which makes for more competition and later for better browsers<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Blink tag is gone<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Strict coding makes you learn to      see mistakes quicker<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can aim to making some money      writing a book about it<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">There are more job opportunities      if you know these new ways<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You learn better to understand how      a browser works<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can use hacks and techniques      with cool names like “be nice to Opera”<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">you start to care more about      metadata, document and character types<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">With more people making slimmer      pages, the amount of data moving in the whole web will be smaller and all      connections faster<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">XHTML has a cooler name than HTML<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">There are more people thinking      about the advantages and disadvantages and coding tricks of XHTML which      makes for a bigger learning forum<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">You can use basically same markup      template for many different websites<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Learning to read and write it fast      makes it possible to use cheaper tools (notepad)<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Google knows this: <o:p></o:p></span>
<ul type="circle">
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">4,380,000 xhtml better than html       &gt; 4,370,000 html better than xhtml<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">206 “xhtml is better than html”       &gt; 87 “html is better than xhtml”<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">2,130,000 xhtml sucks &lt;       10,300,000 html sucks<o:p></o:p></span></li>
</ul>
</li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">When all browsers start to      understand the correct MIME-type (xml), you don’t have to convert all your      websites from html, just to switch to correct MIME<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">By more people using xhtml you      ensure that in the future IE will need to understand the correct MIME-type<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">Accessibility is enforced with      requiring Alt attribute for images<o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal"><span style="font-size: 10pt">There just aren’t this many      reasons to use HTML or entirely Flash instead<o:p></o:p></span></li>
</ol>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/14/55-reasons-to-design-in-xhtml-css/feed/</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>Ten more CSS tricks you may not know</title>
		<link>http://www.programimi.com/2007/09/12/ten-more-css-tricks-you-may-not-know/</link>
		<comments>http://www.programimi.com/2007/09/12/ten-more-css-tricks-you-may-not-know/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 02:15:52 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/12/ten-more-css-tricks-you-may-not-know/</guid>
		<description><![CDATA[

Ten CSS Tricks You May Not Know has proven to be such a success that we decided it was time to offer you ten more CSS tricks that you may not know.
1. Block vs. inline level elements
Nearly all HTML elements are either block or inline elements. The characteristics of block elements include:

Always begin on a [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><a href="http://www.programimi.com/2007/09/04/quick-tips-ten-css-tricks-you-may-not-know/" target="_blank"><strong>Ten CSS Tricks You May Not Know</strong></a> has proven to be such a success that we decided it was time to offer you ten more CSS tricks that you may not know.</p>
<h2>1. Block vs. inline level elements</h2>
<p>Nearly all HTML elements are either block or inline elements. <strong>The characteristics of block elements</strong> include:</p>
<ul>
<li>Always begin on a new line</li>
<li>Height, line-height and top and bottom margins can be manipulated</li>
<li>Width defaults to 100% of their containing element, unless a width is specified</li>
</ul>
<p>Examples of block elements include <code>&lt;div&gt;</code>, <code>&lt;p&gt;</code>, <code>&lt;h1&gt;</code>, <code>&lt;form&gt;</code>, <code>&lt;ul&gt;</code> and <code>&lt;li&gt;</code>. <strong>Inline elements</strong> on the other hand have the <strong>opposite characteristics</strong>:</p>
<ul>
<li>Begin on the same line</li>
<li>Height, line-height and top and bottom margins can&#8217;t be changed</li>
<li>Width is as long as the text/image and can&#8217;t be manipulated</li>
</ul>
<p>Examples of inline elements include <code>&lt;span&gt;</code>, <code>&lt;a&gt;</code>, <code>&lt;label&gt;</code>, <code>&lt;input&gt;</code>, <code>&lt;img&gt;</code>, <code>&lt;strong&gt;</code> and <code>&lt;em&gt;</code>.</p>
<p>To change an element&#8217;s status you can use <code>display: inline</code> or <code>display: block</code>. But what&#8217;s the point of changing an element from being block to inline, or vice-versa? Well, at first it may seem like you might hardly ever use this, but in actual fact this is a very powerful technique, which you can use any time you want to:</p>
<ul>
<li>Have an inline element start on a new line</li>
<li>Have a block element start on the same line</li>
<li>Control the width of an inline element (particularly useful for navigation links)</li>
<li>Manipulate the height of an inline element</li>
<li>Set a background colour as wide as the text for block elements, without having to specify a width</li>
</ul>
<h2>2. Another box model hack alternative</h2>
<p>The <a href="http://tantek.com/CSS/Examples/boxmodelhack.html">box model hack</a> is used to fix a rendering problem in pre-<acronym title="Internet Explorer">IE</acronym> 6 browsers on <acronym title="Personal Computer">PC</acronym>, where by the border and padding are <em>included</em> in the width of an element, as opposed to <em>added on</em>. A number of <acronym title="Cascading Stylesheets">CSS</acronym>-based solutions have been put forward to remedy this, so here&#8217;s another one which we really like:</p>
<p><code>padding: 2em;<br />
border: 1em solid green;<br />
width: 20em;<br />
width/**/:/**/ 14em; 			</code></p>
<p>The first width command is read by all browsers; the second by all browsers <em>except</em> <acronym title="Internet Explorer">IE</acronym>5.x on <acronym title="Personal Computer">PC</acronym>. Because the <strong>second command comes second it takes precedence over the first</strong> &#8211; any command that comes second will always override a preceding command. So, how does all this work?</p>
<p>By placing empty comment tags (/**/) before the colons, <acronym title="Internet Explorer">IE</acronym>5.0 will ignore the command. Likewise, by placing these empty comment tags after the colon, <acronym title="Internet Explorer">IE</acronym>5.5 will ignore the command. By using these two rules in conjunction with each other, we can hide the command from all of <acronym title="Internet Explorer">IE</acronym>5.x.</p>
<h2>3. Minimum width for a page</h2>
<p>A very handy <acronym title="Cascading Stylesheets">CSS</acronym> command that exists is the <code>min-width</code> command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.</p>
<p>Unfortunately, <acronym title="Internet Explorer">IE</acronym> doesn&#8217;t understand this command, so we&#8217;ll need to come up with a new way of making this work in this browser. First, we&#8217;ll insert a <code>&lt;div&gt;</code> under the <code>&lt;body&gt;</code> tag, as we <strong>can&#8217;t assign a minimum width to the <code>&lt;body&gt;</code></strong>:</p>
<p><code> 				&lt;body&gt;<br />
&lt;div id="container"&gt; 			</code></p>
<p>Next we create our <acronym title="Cascading Stylesheets">CSS</acronym> commands, so as to create a minimum width of 600px:</p>
<p><code> 				#container<br />
{<br />
min-width: 600px;<br />
width:expression(document.body.clientWidth &lt; 600? "600px": "auto" );<br />
} 			</code></p>
<p>The first command is the regular minimum width command; the second is a short JavaScript command that only <acronym title="Internet Explorer">IE</acronym> understands. Do note though, this command will cause your <acronym title="Cascading Stylesheets">CSS</acronym> document to invalidate so you may prefer to insert it into the head of each <acronym title="Hypertext Markup Language">HTML</acronym> document to get round this.</p>
<p>You might also want to combine this minimum width with a maximum width:</p>
<p><code> 				#container<br />
{<br />
min-width: 600px;<br />
max-width: 1200px;<br />
width:expression(document.body.clientWidth &lt; 600? "600px" : document.body.clientWidth &gt; 1200? "1200px" : "auto");<br />
} 			</code></p>
<h2>4. <acronym title="Internet Explorer">IE</acronym> and width &amp; height issues</h2>
<p><acronym title="Internet Explorer">IE</acronym> has a rather strange way of doing things. It doesn&#8217;t understand the <code>min-width</code> and <code>min-height</code> commands, but instead interprets <code>width</code> and <code>height</code> as <code>min-width</code> and <code>min-height</code> &#8211; go figure!</p>
<p>This can cause problems, because we may need boxes to be resizable should more text need to go in them or should the user resize text. If we only use the <code>width</code> and <code>height</code> commands on a box then non-<acronym title="Internet Explorer">IE</acronym> browsers won&#8217;t allow the box to resize. If we only use the <code>min-width</code> and <code>min-height</code> commands though then we can&#8217;t control the width or height in <acronym title="Internet Explorer">IE</acronym>!</p>
<p>This can be especially problematic when using <strong>background images</strong>. If you&#8217;re using a background image that&#8217;s 80px wide and 35px high, then you&#8217;ll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text then the box size will need to expand gracefully.</p>
<p>To <strong>resolve this problem</strong>, you can use the following code for a box with <code>class="box"</code>:</p>
<p><code> 				.box<br />
{<br />
width: 80px;<br />
height: 35px;<br />
}</code></p>
<p>html&gt;body .box<br />
{<br />
width: auto;<br />
height: auto;<br />
min-width: 80px;<br />
min-height: 35px;<br />
}</p>
<p>All browsers will read through the first <acronym title="Cascading Stylesheets">CSS</acronym> rule but <acronym title="Internet Explorer">IE</acronym> will ignore the second rule because it makes use of the <a href="http://meyerweb.com/eric/articles/webrev/200006b.html">child selector command</a>. Non-<acronym title="Internet Explorer">IE</acronym> browsers will read through the second one and will override the values from the first rule because this <acronym title="Cascading Stylesheets">CSS</acronym> rule is more specific, and <strong><acronym title="Cascading Stylesheets">CSS</acronym> rules that are more specific always override those that are less specific</strong>.</p>
<h2>5. Text-transform command</h2>
<p>One of the lesser known, but really useful <acronym title="Cascading Stylesheets">CSS</acronym> commands is the <code>text-transform</code> command. Three of the more common values for this rule are: <code>text-transform: uppercase</code>, <code>text-transform: lowercase</code> and <code>text-transform: capitalize</code>. The first rule turns all characters into capital letters, the second turns them all into small letters, and the third makes the first letter of each word capitals.</p>
<p>This command is incredibly useful to help <strong>ensure consistency in style across an entire website</strong>, particularly if there a number of content editors. Say for example your style guide dictates that words in headings must always begin with capital letters. To ensure that this is always the case, use <code>text-transform: capitalize</code>. Even if site editors forget about the capitalisation, their mistake won&#8217;t show up on the website.</p>
<p>It&#8217;s also preferable to <strong>use <code>text-transform: uppercase</code> to capitalise words</strong>, as screen readers may pronounce shorter words in capital letters as acronyms. A great example of this is ‘CONTACT US’, which is pronounced as ‘contact U S’ by some screen readers.</p>
<h2>6. Disappearing text or images in <acronym title="Internet Explorer">IE</acronym>?</h2>
<p><acronym title="Internet Explorer">IE</acronym> has a very strange bug where text or background images sometimes disappears from sight. These items are still actually there, and if you highlight everything on screen or hit refresh they&#8217;ll often re-appear. Kind of strange, huh?</p>
<p>This problem mostly occurs on background images and on text next to a floated element. To <strong>remedy the problem</strong>, simply insert <code>position: relative</code> into the CSS command for the disappearing element, and for some bizarre reason that&#8217;ll usually fix the problem. If this doesn&#8217;t work (it sometimes doesn&#8217;t), assign a width to the offending element in the CSS and that should fix the problem.</p>
<h2>7. Invisible text</h2>
<p>Sometime you may actually want to make text invisible. Invisible text can be especially <strong>useful for screen reader users</strong>, perhaps to assign a label to a form item or insert a heading ahead of a section. Don&#8217;t want to change the visual appearance by inserting these? Make them invisible and no one using a visual browser knows that they&#8217;re there.</p>
<p>You may also want to make text invisible if using a <strong>print or handheld <acronym title="Cascading Stylesheets">CSS</acronym></strong> file, as some information may not need to be displayed on either of these mediums (see below for more on this).</p>
<p>To make text invisible you can use <code>display: none</code> &#8211; easy! This works fine for hiding text from handhelds (if <acronym title="Cascading Stylesheets">CSS</acronym> is supported) and printed web pages, but isn&#8217;t so great for many screen readers. Screen readers are now becoming too clever for their own good, and some will actually ignore the any text that has the rule <code>display: none</code> assigned to it.</p>
<p>For screen readers users therefore, a new approach is needed: <code>position: absolute; left: -9000px</code>. This basically takes the text and positions it 9000px to the left of the left edge of the screen, essentially making it invisible.</p>
<h2>8. <acronym title="Cascading Stylesheets">CSS</acronym> document for handhelds</h2>
<p>A separate <acronym title="Cascading Stylesheets">CSS</acronym> document can be created for <acronym title="Personal Digital Assistant">PDA</acronym>s and mobile phones, and only activated when one of these devices is being used to access your site. More and more websites are creating separate <a href="http://www.alistapart.com/articles/goingtoprint/"><acronym title="Cascading Stylesheets">CSS</acronym> documents for printing</a>, so web pages automatically become print-friendly when users choose to print them. You can also do the same for handheld devices.</p>
<p>The following command is used to call up the <acronym title="Cascading Stylesheets">CSS</acronym> document for handhelds:</p>
<p><code> 				&lt;link type="text/css" rel="stylesheet" href="handheldstyle.css" <strong>media="handheld"</strong> /&gt; 			</code></p>
<p><acronym title="Cascading Stylesheets">CSS</acronym> commands in the handheld <acronym title="Cascading Stylesheets">CSS</acronym> file override any equivalent commands in the main <acronym title="Cascading Stylesheets">CSS</acronym> document. So, what commands should you place in this file?</p>
<p>Ideally, you want handheld web users to <strong>avoid having to scroll across</strong>. To test this, open up your website in a regular browser window and resize it to 150px in width. Then, open up your main <acronym title="Cascading Stylesheets">CSS</acronym> file and insert some new commands at the very bottom of the document. The commands you place here should adjust the layout of the website so that it doesn&#8217;t require horizontal scrolling at a 150px width. Then, open up a new document, cut and paste these new commands over, and save it as handheldstyle.css (or whatever name you want to give it).</p>
<p>What your website offers to handheld web users should be quite different to what it offers on traditional web browsers, as the user experience is quite different. For further information, a book such as <a href="http://www.amazon.com/gp/product/0470844469?ie=UTF8&amp;tag=besbl00-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470844469" target="_blank">Handheld Usability</a> is a great read.</p>
<h2>9. 3-d push button effect</h2>
<p>Back in the early days of the web, 3-d buttons that appeared to become pushed in when moused over were all the rage. At that time, this could only be achieved through images and JavaScript, but now with the advent of <acronym title="Cascading Stylesheets">CSS</acronym> we can go all retro and re-create the desired effect:</p>
<p>The <strong>main <acronym title="Cascading Stylesheets">CSS</acronym> commands</strong>  you&#8217;ll need are:</p>
<p><code> 				a 				{<br />
display: block;<br />
border: 1px solid;<br />
border-color: #aaa #000 #000 #aaa;<br />
width: 8em;<br />
background: #fc0;<br />
}</code></p>
<p>a:hover<br />
{<br />
position: relative;<br />
top: 1px;<br />
left: 1px;<br />
border-color: #000 #aaa #aaa #000;<br />
}</p>
<p>Aside from these commands, you can insert any other commands to achieve the desired presentation effect &#8211; the only limit is your imagination!</p>
<h2>10. Same navigation code on every page</h2>
<p>Most websites highlight the navigation item of the user&#8217;s location in the website, to help users orientate themselves. This is a fundamental requirement for basic usability, but can be a pain as you&#8217;ll need to tweak the <acronym title="Hypertext Markup Language">HTML</acronym> code behind the navigation for each and every page. So can we have the best of both worlds? Is it possible to have the <strong>navigation highlighted on every page, without having to tweak the <acronym title="Hypertext Markup Language">HTML</acronym> code</strong> on each and every page? Of course it is&#8230;</p>
<p>First of all, you&#8217;ll need to assign a class to each navigation item:</p>
<p><code> 				&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="#" <strong>class="home"</strong>&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#" <strong>class="about"</strong>&gt;About us&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#" <strong>class="contact"</strong>&gt;Contact us&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
</code></p>
<p>You&#8217;ll then need to <strong>insert an <code>id</code> into the <code>&lt;body&gt;</code></strong> tag. The <code>id</code> should be representative of where users are in the site and should change when users move to a different site section. When in ‘Home’ it should read <code>&lt;body id="home"&gt;</code>, in ‘About Us’ it should be <code>&lt;body id="about"&gt;</code> and in ‘Contact Us’ <code>&lt;body id="contact"&gt;</code>.</p>
<p>Next, you create a new <acronym title="Cascading Stylesheets">CSS</acronym> rule:</p>
<p><code> 				#home .home, #about .about, #contact .contact<br />
{<br />
<em>commands for highlighted navigation go here</em><br />
} 			</code></p>
<p>This basically creates a rule that only takes effect when <code>class="home"</code> is contained within <code>id="home"</code>, and when <code>class="about"</code> is in <code>id="about"</code> and <code>class="contact"</code> is in <code>id="contact"</code>. These situations will only occur when the user is in the appropriate site section, seamlessly creating our highlighted navigation item.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/12/ten-more-css-tricks-you-may-not-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer &amp; CSS issues</title>
		<link>http://www.programimi.com/2007/09/12/internet-explorer-css-issues/</link>
		<comments>http://www.programimi.com/2007/09/12/internet-explorer-css-issues/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 23:02:31 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/12/internet-explorer-css-issues/</guid>
		<description><![CDATA[

Trying to get CSS-based websites to look the same across all browsers can often be difficult. Many of the problems however lie with Internet Explorer implementing CSS commands differently to other, more standards compliant browsers. All is not lost, however, as many of the differences you see across browsers are caused by the same Internet [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p>Trying to get <acronym title="Cascading Stylesheets">CSS</acronym>-based websites to look the same across all browsers can often be difficult. Many of the problems however lie with Internet Explorer implementing <acronym title="Cascading Stylesheets">CSS</acronym> commands differently to other, more standards compliant browsers. All is not lost, however, as many of the differences you see across browsers are caused by the same Internet Explorer <acronym title="Cascading Stylesheets">CSS</acronym> issues&#8230;</p>
<h2>1. Page elements are narrower in Internet Explorer</h2>
<p>Perhaps the most famous <acronym title="Internet Explorer">IE</acronym> and <acronym title="Cascading Stylesheets">CSS</acronym> problem is Internet Explorer&#8217;s <strong>misinterpretation of the <acronym title="Cascading Stylesheets">CSS</acronym> box model</strong>, which can cause page elements to be narrower in <acronym title="Internet Explorer">IE</acronym>. Every <acronym title="Hypertext Markup Language">HTML</acronym> element is essentially a box, the width of which is the total of its margin, border, padding and content area. Imagine the following <acronym title="Cascading Stylesheets">CSS</acronym> rule:</p>
<p><code> 				div {<br />
margin: 5em;<br />
padding: 4em;<br />
border: 1em solid green;<br />
width: 30em<br />
} 			</code></p>
<p>This means that each <code>div</code> is 50em wide in total. This amount is made up of a 30em wide content area, and a 4em padding, 1em border and 5em (invisible) margin on both the left and right sides.</p>
<p>In <acronym title="Internet Explorer">IE</acronym> however, the <strong>border and padding are included in the width</strong> of the content, as opposed to added on. In <acronym title="Internet Explorer">IE</acronym> therefore, the width of the content is only 20em (30em less 5em padding and border on either side), and the total width of the <code>div</code> is just 40em.<br />
This <acronym title="Cascading Stylesheets">CSS</acronym> box model problem occurs in <acronym title="Internet Explorer">IE</acronym>5.x, and can occur in <acronym title="Internet Explorer">IE</acronym>6, depending on how you declare the <strong><acronym title="International Organization for Standardization">ISO</acronym> value</strong> in the <acronym title="Hypertext Markup Language">HTML</acronym> code. There are two ways of doing this:</p>
<ul>
<li><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;</code></li>
<li><code>&lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;</code></li>
</ul>
<p>The first command is placed on the very first line of the <acronym title="Hypertext Markup Language">HTML</acronym> document and the second can be placed anywhere within the <code>&lt;head&gt;</code>. In order for <acronym title="eXtensible Hypertext Markup Language">XHTML</acronym> pages to validate it&#8217;s compulsory to use one of these commands. The <acronym title="Worldwide Web Consortium">W3C</acronym> recommends using the first command as the second will be phased out in the future.</p>
<p>By using the first command however, Internet Explorer 6 will render the <acronym title="Cascading Stylesheets">CSS</acronym> box model incorrectly, just like in version 5 browsers. To fix the box model problem, you&#8217;ll need to insert a <acronym title="Cascading Stylesheets">CSS</acronym> hack to send <strong>different width values to different browsers</strong>. The <acronym title="Cascading Stylesheets">CSS</acronym> hack you use will depend on which <acronym title="International Organization for Standardization">ISO</acronym> value you use, and therefore which versions of <acronym title="Internet Explorer">IE</acronym> are rendering the box model incorrectly.</p>
<p>To <strong>fix up only <acronym title="Internet Explorer">IE</acronym>5.x</strong>, use the following <acronym title="Cascading Stylesheets">CSS</acronym> commands:</p>
<p><code> 				div {<br />
margin: 5em;<br />
padding: 4em;<br />
border: 1em solid green;<br />
<strong>width/**/:/**/ 40em;</strong><br />
width: 30em<br />
} 			</code></p>
<p>To fix up <strong>all versions of <acronym title="Internet Explorer">IE</acronym></strong>, use these <acronym title="Cascading Stylesheets">CSS</acronym> commands:</p>
<p><code> 				div {<br />
margin: 5em;<br />
padding: 4em;<br />
border: 1em solid green;<br />
<strong>width: 40em</strong><br />
}<br />
<strong>html&gt;body</strong> div {<br />
width: 30em<br />
} 			</code></p>
<p>(See the article, <a href="http://www.programimi.com/2007/09/04/css-hacks-browser-detection/" target="_blank">CSS hacks &amp; browser detection</a> for more on these hacks.)</p>
<h2>2. Text spilling out of its container in non-<acronym title="Internet Explorer">IE</acronym> browsers</h2>
<p>Internet Explorer, unlike other browsers, will expand borders and background colours so text doesn&#8217;t spill out of its containing element.</p>
<p>If you&#8217;re going to view this in Internet Explorer, the box should look fine. In all other browsers the text is spilling out of the right-hand side of the box. The box has been assigned <code>class="box"</code> and has the following <acronym title="Cascading Stylesheets">CSS</acronym> commands assigned to it:<code> 				.box {<br />
width: 40px;<br />
border: 2px solid #781351;<br />
padding: 3px;<br />
background: #d7b9c9;<br />
white-space: nowrap<br />
} 			</code></p>
<p>Non-<acronym title="Internet Explorer">IE</acronym> browsers will adhere to the <code>width: 40px</code> <acronym title="Cascading Stylesheets">CSS</acronym> command, which is why the box doesn&#8217;t expand in these browsers. <strong><acronym title="Internet Explorer">IE</acronym> instead interprets <code>width</code> as <code>min-width</code></strong>, and therefore expands the box to fit the text (the same applies with <code>height</code> and <code>min-height</code>).</p>
<p>To ensure the text doesn&#8217;t spill out of the box in all browsers, you&#8217;ll need to use the following <acronym title="Cascading Stylesheets">CSS</acronym> rule, in addition to the first one:</p>
<p><code> 				html&gt;body .box<br />
{<br />
width: auto;<br />
min-width: 40px<br />
} 			</code></p>
<p><acronym title="Internet Explorer">IE</acronym> will ignore this <acronym title="Cascading Stylesheets">CSS</acronym> command, as the command has <code>html&gt;body</code> at the front of it (see the article, <a href="http://www.programimi.com/2007/09/04/css-hacks-browser-detection/" target="_blank">CSS hacks &amp; browser detection</a> for more on this). As such, this <acronym title="Cascading Stylesheets">CSS</acronym> command is only for non-<acronym title="Internet Explorer">IE</acronym> browsers. The first <acronym title="Cascading Stylesheets">CSS</acronym> rule, <code>width: auto</code>, cancels out the original <code>width</code> rule. The second command, <code>min-width: 40px</code> then assigns a minimum width to the box, so the box will always expand to fit the text.</p>
<p class="clear">Check out the box again (you won&#8217;t see any difference in Internet Explorer, so open this up in another browser to see the change); Much better!</p>
<h2>3. Disappearing background images</h2>
<p><acronym title="Internet Explorer">IE</acronym> has a very freaky bug where it likes to make background images (and sometimes even text &#8211; particularly if there are floated elements around) disappear. This often happens when you <strong>scroll up and down</strong> on a web page and you can usually make the background re-appear by refreshing the page.</p>
<p>Obviously you won&#8217;t want your site visitors to have to refresh a page to see a background image in full! A freaky solution to this freaky problem is to insert the <acronym title="Cascading Stylesheets">CSS</acronym> command, <code>position: relative</code> into the <acronym title="Cascading Stylesheets">CSS</acronym> rule containing the background image:</p>
<p><code> 				.foo {<br />
background: url(filename.jpg);<br />
<strong>position: relative</strong><br />
} 			</code></p>
<p>Occasionally this won&#8217;t work, so <strong>another solution</strong> is to assign a width or a height to the element with the background image. You may not want to assign a height or width, so a solution is to assign a height of 1% for Internet Explorer. Because <acronym title="Internet Explorer">IE</acronym> interprets <code>height</code> as <code>min-height</code> (see point 2 above) this <acronym title="Cascading Stylesheets">CSS</acronym> rule won&#8217;t affect the appearance:</p>
<p><code> 				.foo {<br />
background: url(filename.jpg);<br />
<strong>height: 1%</strong><br />
}<br />
html&gt;body .foo {<br />
<strong>height: auto</strong><br />
} 			</code></p>
<p>The <code>height: 1%</code> <acronym title="Cascading Stylesheets">CSS</acronym> command is cancelled out by the <code>height: auto</code> <acronym title="Cascading Stylesheets">CSS</acronym> command. Internet Explorer doesn&#8217;t understand <code>html&gt;body</code>, so by inserting this in front of the second <acronym title="Cascading Stylesheets">CSS</acronym> rule this whole <acronym title="Cascading Stylesheets">CSS</acronym> rule is ignored by <acronym title="Internet Explorer">IE</acronym>.</p>
<h2>4. Widths only working on <acronym title="Internet Explorer">IE</acronym></h2>
<p>Every HTML element is either a block or an inline element. Examples of block elements include <code>&lt;div&gt;</code>, <code>&lt;p&gt;</code>, <code>&lt;h1&gt;</code>, <code>&lt;form&gt;</code> and <code>&lt;li&gt;</code>. Example of inline elements include <code>&lt;span&gt;</code>, <code>&lt;a&gt;</code>, <code>&lt;label&gt;</code>, <code>&lt;strong&gt;</code> and <code>&lt;em&gt;</code>.</p>
<p>One of the characteristics of inline elements is that you <strong>can&#8217;t change the width of an inline element</strong>. The following <acronym title="Cascading Stylesheets">CSS</acronym> rule shouldn&#8217;t, in theory, work:</p>
<p><code> 				span {<br />
width: 100px<br />
} 			</code></p>
<p>This <acronym title="Cascading Stylesheets">CSS</acronym> rule won&#8217;t work, except in Internet Explorer where each span will now have a width of 100px. In every other browser however, the width of the span will simply be the width of the number of characters contained in the element. <strong>The solution? Make the span a block level element</strong>:</p>
<p><code> 				span {<br />
width: 100px;<br />
<strong>display: block</strong><br />
} 			</code></p>
<p>(Turning the span into a block element will make the <code>width</code> command work in every browser, but it will also make the span begin on a new line. To combat this, you could assign <code>float: left</code> to the span.)</p>
<h2>5. Unstyled version of web page appearing in <acronym title="Internet Explorer">IE</acronym></h2>
<p>When your website loads up in Internet Explorer, does an <strong>unstyled version of the page appear for a second or two</strong>, before the styled version kicks in this? If so, your website may be suffering from what&#8217;s known as the <a href="http://www.bluerobot.com/web/css/fouc.asp">Flash Of Unstyled Content</a> (or FOUC).</p>
<p>If you&#8217;re using the @import directive (e.g. <code>&lt;style type="text/css"&gt;@import "styles.css";&lt;/style&gt;</code>) to call up your <acronym title="Cascading Stylesheets">CSS</acronym> file then this phenomenon may be happening on your website in <acronym title="Internet Explorer">IE</acronym>. It&#8217;s weird, there&#8217;s no logical explanation for it, but this problem obviously needs to be fixed.</p>
<p>The simple <strong>solution</strong> to this illogical problem is an equally illogical solution &#8211; insert either a link or a script element into the header:</p>
<ul>
<li><code>&lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt;</code></li>
<li><code>&lt;link rel="stylesheet" href="styles.css" type="text/css" media="print" /&gt;</code></li>
</ul>
<p>It doesn&#8217;t matter which one you insert (or even if you insert both). If you provide a print stylesheet, using the link element to reference it (as indicated in the example above), then you&#8217;ll never see the <acronym title="Flash Of Unstyled Content">FOUC</acronym> phenomenon.</p>
<h2>6. Fixed width web page not sitting in centre of window</h2>
<p>Got a fixed width website and can&#8217;t get it to centrally align in the window in Internet Explorer? Or you can get it to centrally align in <acronym title="Internet Explorer">IE</acronym> but not in any other browser? Fear not, it&#8217;s not your fault! Unfortunately, the correct way of centrally aligning content through <acronym title="Cascading Stylesheets">CSS</acronym> doesn&#8217;t actually work in <acronym title="Internet Explorer">IE</acronym>:</p>
<p><code> 				#container {<br />
width: 770px;<br />
margin: 0 auto<br />
} 			</code></p>
<p>The second command, <code>margin: 0 auto</code>, basically gives our containing element an automatic margin on the left and right, thereby positioning the containing element in the centre of the browser window.</p>
<p><acronym title="Internet Explorer">IE</acronym> however, will need slightly different commands to make this work:</p>
<p><code> 				body {<br />
<strong>text-align: center</strong><br />
}<br />
#container {<br />
width: 770px;<br />
margin: 0 auto;<br />
<strong>text-align: left</strong><br />
} 			</code></p>
<p>This will then centrally align the container in <acronym title="Internet Explorer">IE</acronym> too. To prevent the text from centrally aligning too, we insert <code>text-align: left</code> into the container div.</p>
<p>&#8212;</p>
<p><em>This article was written by Trenton Moss. Trenton&#8217;s crazy about web usability and accessibility &#8211; so crazy that he went and started his own web usability and accessibility consultancy to help make the Internet a better place for everyone. He knows an awful lot about the Disability Discrimination Act and spends much of his time working on the world&#8217;s most accessible CMS. </em></p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/12/internet-explorer-css-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Widget Walkthrough</title>
		<link>http://www.programimi.com/2007/09/11/widget-walkthrough/</link>
		<comments>http://www.programimi.com/2007/09/11/widget-walkthrough/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 11:49:12 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/11/widget-walkthrough/</guid>
		<description><![CDATA[

The first half of this tutorial introduced you to making a rudimentary but functional widget of the sort you can find on Yahoo&#8217;s site since its purchase of Konfabulator. In this article, you&#8217;ll add the finishing touches to increase its functionality.Widget Walkthrough 
The preferences that you created in the first part of this article won&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><span class="txt">The first half of this tutorial introduced you to making a rudimentary but functional widget of the sort you can find on Yahoo&#8217;s site since its purchase of Konfabulator. In this article, you&#8217;ll add the finishing touches to increase its functionality.<strong>Widget Walkthrough </strong></span></p>
<p>The preferences that you created in the first part of this article won&#8217;t actually do anything on their own; they&#8217;ll need the following JavaScript in order to actually make the required changes:</p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;action trigger=&#8221;onLoad&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;![CDATA[<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    function updatepreferences() {<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      datatextarea.font = preferences.textfontpref.value;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      datatextarea.color = preferences.textcolorpref.value;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      datatextarea.size = preferences.textsizepref.value;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      datatextarea.style = preferences.textstylepref.value;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    }<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    updatepreferences();<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">]]&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;/action&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;action trigger =&#8221;onPreferencesChanged&#8221;&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    updatepreferences();<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/action&gt;</span></font></p>
<p>As you can see, each action (onLoad and onPreferencesChanged) is contained within its own &lt;action&gt; element.  All each line of the updatepreferences() function is doing is setting the attributes of the textarea element, much as CSS would with HTML.  I&#8217;ve included the opening CDATA tag as we&#8217;ll need it for one of the next functions.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Widget Walkthrough &#8211; Getting the headlines</strong></span></span></p>
<p>Now you need to actually get the news headlines from the BBC web server.  To do this, you&#8217;ll need to make use of the URL widget engine object:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    function getdata() {<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">      var url = new URL();</span></p>
<p><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">      url.location =<br />
&#8220;http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/<br />
technology/rss.xml&#8221;;<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">      feeddata = url.fetch();<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    }<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    getdata();</span></p>
<p>This will instruct the widget to fetch whatever file is waiting at the above URL.  You now need to display the file:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    function setdata() {<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">      datatextarea.data = feeddata;<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    }<br />
</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB">    setdata();</span></p>
<p>This function can be added into the existing onLoad &lt;action&gt; and simply creates a new URL object, sets the location attribute to the source of the feed, and then retrieves the information as the specified location.  At this point, you should have something that looks a little like this:</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/widget_feeding.jpg" alt="widget_feeding.jpg" /></p>
<p><span class="txt">The function works; it grabs the file located at the target URL, but unfortunately, this happens to be in an XML format! This means our textarea is currently displaying the entire XML file! Another function, to traverse the XML document and pull out just the headlines, is going to be needed. Fortunately, the widget engine provides XPath 1.0 support to make extracting the required items relatively easy.</span></p>
<p>There are several steps involved in getting the data that we want; if you look at the XML document obtained by the url.fetch command, you&#8217;ll see that the news headlines we want to grab appear in an element called title, which is a child of the item element, which is a child of the channel element, which finally, is a child of the rss element.  Therefore, the element we need is a great-grandchild of the root element. Remove the setData() function as we can extend the getData() function to display the headlines once they have been extracted.</p>
<p><span class="contentpagetitle"><strong>Widget Walkthrough &#8211; Using loops</strong></span></p>
<p>The Widget reference manual states that you should use a try catch loop to perform XPath functions, so you can add one to your getData() function.  You will first need to obtain the XML document and place it in a variable using the parse method:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">try {<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        doc = XMLDOM.parse(feeddata);</span></p>
<p>Next, you need to specify which elements in the XML file you want to match. This is the XPath element of your function:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        titlelist = doc.evaluate( &#8220;rss/channel/item/title&#8221; );<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        datatextarea.data = &#8220;&#8221;;</span></p>
<p>You now need to create an array to hold the headlines as separate DOMElement objects:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        titles = new Array();</span></p>
<p>In this particular rss file, there are always 19 headlines, however, if you were using a different feed, you may not know the number of headlines in advance so it is a good idea to use a for loop that operates on the length of your array:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        for (n = 0; n &lt; titlelist.length; n++) {</span></p>
<p>The DOMNodeList returned by the XPath function has a built-in property of item() which can be used to specify which DOMElement in the list you are referring to. In this case, we can match the number of the array item with the item we want to store in the array:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">          titles[n] = titlelist.item(n);</span></p>
<p>Finally, each time the loop iterates, you can set the data property of the &lt;textarea&gt; to the data held in the array item. The actual item held in the array is the DOMElement; to get the actual text held in the object you need to address the firstChild of the element.  The JavaScript new line character is also specified (twice) to break up the headlines:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">          datatextarea.data += titles[n].firstChild.data + &#8220;nn&#8221;;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        }<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    }<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">      catch(e) {<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        print(e);<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    }</span></p>
<p><span class="txt"><span class="txt"><span class="txt"> <span class="txt"><span class="contentpagetitle"><strong>Widget Walkthrough &#8211; Fine tuning headline retrieval</strong></span></span></span></span></span></p>
<p>If you save the changes and reload the file now, the headlines should appear as if by magic! Using the &lt;textarea&gt; is good because it makes setting the preferences easy and handles the word wrapping well.  One major flaw of this though is that it&#8217;s not possible to set the URL of each individual headline. To compensate for this, you can add a right-click menu item to the widget that takes you to either the main news front page, or a page containing the list of headlines displayed.  To do this, you can add the following code block to the &lt;textarea&gt; element:</p>
<p><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;contextMenuItems&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        &lt;menuItem title=&#8221;Open BBC Technology News&#8221;&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">          &lt;onSelect&gt;openURL<br />
(&#8221;http://news.bbc.co.uk/1/hi/technology/default.stm&#8221;);&lt;/onSelect&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        &lt;/menuItem&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        &lt;menuItem title=&#8221;Open the actual headlines page&#8221;&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">          &lt;onSelect&gt;openURL<br />
(http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml);<br />
&lt;/onSelect&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">        &lt;/menuitem&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">      &lt;/contextMenuItems&gt;</span></p>
<p>This at least provides you with a way of reading the full news stories.  Another thing that you need to consider is a way of updating the file used as the source of the data; if the computer and widget are left running, the reader will just display the same data, forever. A timer element can be used to specify that an action could be carried out repeatedly on a set interval:</p>
<p style="text-align: justify"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;timer&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;interval&gt;10&lt;/interval&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;onTimerFired&gt;getdata();&lt;/onTimerFired&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/timer&gt;</span></p>
<p>The interval is measured in seconds, but this kind of widget wouldn&#8217;t really need to grab a new rss file every ten seconds. Depending on the frequency of updates at the source, you could probably set it to update maybe several times daily.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/widget_finished.jpg" alt="widget_finished.jpg" /></p>
<p><span class="txt"><span class="contentpagetitle"><strong>Widget Walkthrough &#8211; Publishing your widget</strong></span></span></p>
<p>In order to get your widget published on the Yahoo! Widget Gallery, you need to switch off debugging and package your widget. Right at the top of the file, you&#8217;ll find the &lt;debug&gt; element; set this to off. To package the application and produce the flat, one-file version of the existing files and folder structure, you&#8217;ll need to get to grips with the command line interface (CLI) included in the SDK. The converter is situated (on a Windows XP system) at the following location:</p>
<p><strong>C:Program FilesYahoo!Yahoo! Widget Engine</strong></p>
<p>You need to create an output directory at this stage so create a folder, also at the above location, called feeder or something similar. Now open a command prompt.  It will probably open (on a Windows XP system) in your My Document folder so you&#8217;ll need to use the cd (change directory) command to browse to the location of the CLI. You should also move your widget folder into the same directory as the CLI and output directory. Once this has been done, use the following command to package your creation:</p>
<p><span style="font-family: 'Microsoft Sans Serif'" lang="EN-GB">converter_4a convert -v -flat TechFeeder.widget -o <em>outputDirName </em></span></p>
<p>You should then end up with a flat file package containing all of the files that make up the widget in the output folder. Your widget should now be ready to go onto the gallery, but don&#8217;t submit this one (because I already have).</p>
<p>The tagline displayed on the home page of the Widget gallery is &#8220;The grass is greener on both sides&#8221; which pays homage to widgets&#8217; cross platform compatibility. When creating widgets, you should ensure that you test your widget on a Mac and that it runs on both Mac and Windows platforms. I have tested this widget on a Mac and unfortunately, it doesn&#8217;t work as well as it does on Windows systems; instead, it just displays the first headline. I don&#8217;t actually know why this is, but I am investigating. In the meantime however, I&#8217;ve specified on the gallery that it&#8217;s Windows only. Also, the Widget optimizer tool is supposed to be used to remove unnecessary memory forks on widget created on the Mac, but like the converter tool it isn&#8217;t currently available, so for the time being, those of you on Macs I guess will have to forgo this at present.</p>
<p>There is a lot more that could be done to refine the widget. At this stage it really is just a version 1.0 release. You could add a function that automatically scrolls the headlines perhaps, or create the headlines as individual text elements, each with their own URL property to make them clickable links to each of the news stories, or even include the description in a title element that displays when the mouse runs over each text element; the possibilities are endless.  But what you have now is a very basic, but fully functional widget, produced with ease and in not much time at all. This is the beauty of the Yahoo! Widget Engine, speed and ease of deployment and fully functional information management right on your desktop.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/11/widget-walkthrough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying ADO Retrieved Data with XML Islands</title>
		<link>http://www.programimi.com/2007/09/11/displaying-ado-retrieved-data-with-xml-islands/</link>
		<comments>http://www.programimi.com/2007/09/11/displaying-ado-retrieved-data-with-xml-islands/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 08:46:58 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/11/displaying-ado-retrieved-data-with-xml-islands/</guid>
		<description><![CDATA[

An XML data island is a piece of well-formed XML embedded into an HTML file. This article will show you how to retrieve data in an XML format from a database using ADO; you will also learn how to bind this data into an HTML document.Introduction
The previous tutorial, The Why and How of XML Data [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><span class="txt">An XML data island is a piece of well-formed XML embedded into an HTML file. This article will show you how to retrieve data in an XML format from a database using ADO; you will also learn how to bind this data into an HTML document.<strong>Introduction</strong></span></p>
<p>The previous tutorial, <a href="http://www.programimi.com/2007/09/07/the-why-and-how-of-xml-data-islands/" target="_blank"><font color="#0000ff">The Why and How of XML Data Islands</font></a><em>,</em> considered embedding a well formed XML fragment into an HTML file to create an XML data island. The article also showed how one could access data embedded in the XML file. The tutorial also described data binding to various HTML tags. However the XML data used was a hard-coded XML fragment.</p>
<p>In this tutorial, how data in XML format can be retrieved from a database using ADO will be described. The XML data obtained using ADO will be reviewed. An example of how <strong>Jet</strong> Data types are associated with XML data types will be shown. This will be followed by how to use the data to bind it to an HTML document. After all, this is what the client is after. It will be helpful if the reader reviews the previous article and the XML related articles to which you can find links on this  <a href="http://www.angelfire.com/vt2/hodentek/" rel="nofollow" target="_blank"><font color="#0000ff">site</font></a>.</p>
<p><strong>Data to XML Conversion using ADO</strong></p>
<p>Persisting data in the XML format is one of the most important features of ADO since the 2.5 version. This means that ADO recordsets can be saved as an XML file to a location of your choice. Alternatively they can also be saved to a <em>Stream</em> object. Since the data is derived from a database together with the data, the data structure comes with it. Ideally this format should be able to be transparently used by any machine.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; Extracting XML formatted data example</strong></span></span></p>
<p>Using the <strong>save()</strong> method of ADO, you could save the recordset to a file as shown in the next paragraph. The recordset is created by accessing an MDB file on the hard drive. Not all the columns in the &#8216;<em>Employees</em>&#8216; table in the Northwind database will be saved as an XML file. The variable <em>fileName</em> points to the location on the hard drive where the XML file will be saved.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml011.jpg" alt="adoxml011.jpg" /></p>
<p><span class="txt"><strong>Create UI to test code</strong></span></p>
<p>On a form in your MS Access application add a button, and to the click event of this button add the following code. The statement</p>
<p><em>rs.save fileName, <strong>adPersistXML</strong></em> &gt;</p>
<p>can also be saved as</p>
<p><em>rs.save fileName2, <strong>adPersistADTG</strong></em></p>
<p>where <em>fileName2</em> will have an <em>.adtg</em> extension. This is yet another proprietary format called the <em>Advanced Data TableGram</em> format. We will only look at the persisted XML formatted file.</p>
<pre>Private Sub Command0_Click()</pre>
<pre>Dim rs As New ADODB.Recordset</pre>
<pre>fileName = "C:NwindEmployees.xml"</pre>
<pre>rs.Open "Select * from Employees where LastName='Peacock'", _</pre>
<pre>"Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _</pre>
<pre>"Data Source=C:Documents and SettingsJayMy DocumentsRetrieve.mdb;" &amp; _</pre>
<pre>"Persist Security Info=False", adOpenKeyset, adLockOptimistic,</pre>
<pre>adCmdText</pre>
<pre>If Dir$(fileName) &lt;&gt; "" Then Kill fileName</pre>
<pre>rs.Save fileName, adPersistXML</pre>
<pre>End Sub</pre>
<p>In the above code the recordset for the indicated SQL statement will be saved.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; The Saved XML file</strong></span></span></p>
<p>If you open the file <em>C:NwindEmployees.xml</em> in a text editor you can see the full details.</p>
<pre>&lt;xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'</pre>
<pre>        xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'</pre>
<pre>        xmlns:rs='urn:schemas-microsoft-com:rowset'</pre>
<pre>        xmlns:z='#RowsetSchema'&gt;</pre>
<pre>&lt;s:Schema id='RowsetSchema'&gt;</pre>
<pre>        &lt;s:ElementType name='row' content='eltOnly' rs:updatable='true'&gt;</pre>
<pre>               &lt;s:AttributeType name='Address' rs:number='8'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Address'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='60'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='BirthDate' rs:number='6'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='BirthDate'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='DateTime'rs:dbtype='variantdate' dt:maxLength='16' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='City' rs:number='9'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='City'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Country' rs:number='12'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Country'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='EmployeeID' rs:number='1'rs:maydefer='true' rs:writeunknown='true' rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='EmployeeID'rs:autoincrement='true'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='int' dt:maxLength='4'rs:precision='10' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Extension' rs:number='14'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Extension'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='4'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='FirstName' rs:number='3'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='FirstName'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='10'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='HireDate' rs:number='7'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='HireDate'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='dateTime'rs:dbtype='variantdate' dt:maxLength='16' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='HomePhone' rs:number='13'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='HomePhone'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='24'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='LastName' rs:number='2'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='LastName'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='20'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Notes' rs:number='16'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Notes'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string'dt:maxLength='536870910' rs:long='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Photo' rs:number='15'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Photo'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='255'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='PostalCode' rs:number='11'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='PostalCode'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='10'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Region' rs:number='10'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Region'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='ReportsTo' rs:number='17'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='ReportsTo'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='int' dt:maxLength='4'rs:precision='10' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Title' rs:number='4'rs:nullable='true' rs:maydefer='true' rs:write='true'rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Title'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='30'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='TitleOfCourtesy'rs:number='5' rs:nullable='true' rs:maydefer='true' rs:write='true'</pre>
<pre>                        rs:basetable='Employees'rs:basecolumn='TitleOfCourtesy'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='25'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:extends type='rs:rowbase'/&gt;</pre>
<pre>        &lt;/s:ElementType&gt;</pre>
<pre>&lt;/s:Schema&gt;</pre>
<pre>&lt;rs:data&gt;</pre>
<pre>        &lt;z:row Address='4110 Old Redmond Rd.'BirthDate='1958-09-19T00:00:00' City='Redmond' Country='USA'EmployeeID='4'</pre>
<pre>                Extension='5176' FirstName='Margaret'HireDate='1993-05-03T00:00:00' HomePhone='(206) 555-8122'LastName='Peacock'</pre>
<pre>                Notes='Margaret holds a BA in English literature fromConcordia College and an MA from the American Institute of Culinary Arts.She was temporarily assigned to the London office before returning to her

permanent post in Seattle.'</pre>
<pre>                Photo='EmpID4.bmp' PostalCode='98052' Region='WA'ReportsTo='2' Title='Sales Representative' TitleOfCourtesy='Mrs.'/&gt;</pre>
<pre>&lt;/rs:data&gt;</pre>
<pre>&lt;/xml&gt;</pre>
<p><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; Reviewing the saved file</strong></span></p>
<p>Although the file is large, it consists basically of two parts, as shown in the browser display of this file after collapsing all the details. As seen in the next picture, the file&#8217;s two parts are the &#8216;Schema&#8217; and the &#8216;Data&#8217; represented by their prefixes, &#8216;<strong>s:</strong>&#8216; and &#8216;<strong>rs:</strong>&#8216; as shown in the namespaces &#8212; the first four lines in the document which have the prefix <strong>xmlns.</strong></p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml021.jpg" alt="adoxml021.jpg" /></p>
<p><span class="txt"><strong>The schema section</strong></span></p>
<p>The next picture shows just one element from the expanded &#8216;<strong>s</strong>&#8216; node in the displayed XML file in the browser. You can also see that it is <strong>updatable</strong>. This particular slice corresponds to the &#8216;<em>Address</em>&#8216; field of the <em>Employees</em> table shown in the first picture. The fields are listed alphabetically in the persisted file. The other elements also show the various attributes of the Address field. In the original table, the <em>Address</em> field&#8217;s <em>Data type</em> is<em> text</em> and <em>field size</em> is <em>60</em>. The XML attribute with the prefix &#8216;dt&#8217; which marks the beginning of each row shows this information. The &#8216;text&#8217; has become &#8217;string&#8217; and the field size has become &#8216;maxlength.&#8217; The schema information therefore is an accurate representation of the data structure.</p>
<p><img src="http://images.devshed.com/da/stories/images_adoxmlisle/adoxml031.jpg" border="0" /></p>
<p><strong>The Data Section</strong></p>
<p>The next section shows the only row of data taken from the data section. The prefix &#8216;z&#8217; marks the beginning of the data. The XML file has only one row of the table returned corresponding to the <strong>LastName=&#8217;Peacock.</strong>&#8216;</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/peacock1.jpg" alt="peacock1.jpg" /></p>
<p><span class="txt"><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; Data types in Access 2003 and XML file</strong></span></span></p>
<p>In MS Access there are several data types that are typical to its Jet Library. In order to look at how the data goes over into XML, a table, called &#8216;<strong>Whimsical</strong>&#8216; was contrived which has all the data types but contains only a single row of data. This was opened just like the previous table and the saved file was examined. In the next picture you see the table and in the one that follows, you see the &#8217;schema&#8217; section. The data types, &#8216;bitmap&#8217;, and &#8216;hyperlink&#8217; can take up a large amount of space. This one row of data saved to file takes up as much as 0.5 MB.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml061.jpg" alt="adoxml061.jpg" /></p>
<p><span class="txt">This is the &#8216;Schema&#8217; section of the above file. Review each of the data types and you&#8217;ll see the corresponding <strong>dt:type</strong> in the XML file.</span></p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml051.jpg" alt="adoxml051.jpg" /></p>
<p><span class="txt"><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; Displaying retrieved XML in an HTML document</strong></span></span></p>
<p><strong>Creating an XML Data Island</strong></p>
<p>From the previous tutorial we know that we need to embed the XML in an XML document to produce the <em>XML Data Island</em>. The ADO&#8217;s <em>save()</em> method does not produce a data island. This can be built in two steps. First of all, to associate the &#8216;Data&#8217; contained in the XML to the bondable tags of the HTML, we need a basis of association. This is given by the following XML block with the id=&#8217;test.&#8217;</p>
<pre>&lt;XML id="test"&gt;</pre>
<pre></pre>
<pre></pre>
<p><!-- Here goes the data--></p>
<pre>&lt;/XML&gt;</pre>
<p>In the second step, you will notice that XML is already the first tag in the saved file. Since you cannot have two XML tags, you modify the saved file by prefixing <strong>ado</strong> to <strong>xml</strong> and changing it to <strong>adoxml</strong> as shown. This will be embedded in the previous block and the resulting XML is the XML Data Island.</p>
<pre>&lt;<span style="color: red">adoxml</span> xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'</pre>
<pre>        xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'</pre>
<pre>        xmlns:rs='urn:schemas-microsoft-com:rowset'</pre>
<pre>        xmlns:z='#RowsetSchema'&gt;</pre>
<pre>&lt;s:Schema id='RowsetSchema'&gt;</pre>
<pre>        &lt;s:ElementType name='row' content='eltOnly' rs:updatable='true'&gt;</pre>
<pre>               &lt;s:AttributeType name='Address' rs:number='8'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Address'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='60'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='BirthDate' rs:number='6'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='BirthDate'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='dateTime'rs:dbtype='variantdate' dt:maxLength='16' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='City' rs:number='9'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='City'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Country' rs:number='12'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Country'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='EmployeeID' rs:number='1'rs:maydefer='true' rs:writeunknown='true' rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='EmployeeID'rs:autoincrement='true'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='int' dt:maxLength='4'rs:precision='10' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Extension' rs:number='14'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Extension'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='4'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='FirstName' rs:number='3'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='FirstName'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='10'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='HireDate' rs:number='7'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='HireDate'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='dateTime'rs:dbtype='variantdate' dt:maxLength='16' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='HomePhone' rs:number='13'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='HomePhone'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='24'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='LastName' rs:number='2'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='LastName'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='20'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Notes' rs:number='16'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Notes'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string'dt:maxLength='536870910' rs:long='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Photo' rs:number='15'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Photo'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='255'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='PostalCode' rs:number='11'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='PostalCode'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='10'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Region' rs:number='10'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Region'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='15'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='ReportsTo' rs:number='17'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='ReportsTo'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='int' dt:maxLength='4'rs:precision='10' rs:fixedlength='true'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='Title' rs:number='4'rs:nullable='true' rs:maydefer='true' rs:write='true'

rs:basetable='Employees'</pre>
<pre>                        rs:basecolumn='Title'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='30'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:AttributeType name='TitleOfCourtesy' rs:number='5'rs:nullable='true' rs:maydefer='true' rs:write='true'</pre>
<pre>                        rs:basetable='Employees'rs:basecolumn='TitleOfCourtesy'&gt;</pre>
<pre>                       &lt;s:datatype dt:type='string' dt:maxLength='25'/&gt;</pre>
<pre>               &lt;/s:AttributeType&gt;</pre>
<pre>               &lt;s:extends type='rs:rowbase'/&gt;</pre>
<pre>        &lt;/s:ElementType&gt;</pre>
<pre>&lt;/s:Schema&gt;</pre>
<pre>&lt;rs:data&gt;</pre>
<pre>        &lt;z:row Address='4110 Old Redmond Rd.'BirthDate='1958-09-19T00:00:00' City='Redmond' Country='USA'

EmployeeID='4'</pre>
<pre>                Extension='5176' FirstName='Margaret'HireDate='1993-05-03T00:00:00' HomePhone='(206) 555-8122'

LastName='Peacock'</pre>
<pre>                Notes='Margaret holds a BA in English literature fromConcordia College and an MA from the American Institute of Culinary Arts.

She was temporarily assigned to the London office before returning to her

permanent post in Seattle.'</pre>
<pre>                Photo='EmpID4.bmp' PostalCode='98052' Region='WA'ReportsTo='2' Title='Sales Representative' TitleOfCourtesy='Mrs.'/&gt;</pre>
<pre>&lt;/rs:data&gt;</pre>
<pre>&lt;/<span style="color: red">adoxml</span>&gt;</pre>
<p><span class="txt"><span class="contentpagetitle"><strong>Displaying ADO Retrieved Data with XML Islands &#8211; Creating an HTML document which can display the XML Data</strong></span></span></p>
<p><strong>AdoIsland.html</strong></p>
<p>In the code shown next, insert the XML data island created in the previous section and save it as <strong>AdoIsland.htm</strong>. Make sure the DATASRC attribute of the table corresponds to the ID field of the XML Data Island. The DATAFIELD attribute refers respectively to the data fields in the XML data island.</p>
<pre>&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;</pre>
<pre>&lt;body&gt;</pre>
<pre>&lt;table DATASRC="<span style="color: red">#Test</span>"&gt;</pre>
<pre>&lt;tr&gt;</pre>
<pre>&lt;tr&gt;&lt;td&gt;</pre>
<pre>&lt;table <span style="color: blue">DATAsrc="#Test"</span> <span style="color: blue">DATAFLD="rs:data"</span> border="1"</pre>
<pre>bgcolor="yellow"&gt;</pre>
<pre>&lt;tr&gt;&lt;td&gt;</pre>
<pre>&lt;table <span style="color: blue">DATAsrc="#Test"</span> <span style="color: blue">DATAFLD="z:row"</span>&gt;</pre>
<pre>&lt;tr&gt;</pre>
<pre>&lt;td&gt;&lt;span <span style="color: blue">DATAFLD</span>="EmployeeID"&gt;&lt;/span&lt;/td&gt;</pre>
<pre>&lt;td&gt;&lt;span <span style="color: blue">DATAFLD</span>="FirstName"&gt;&lt;/span&lt;/td&gt;</pre>
<pre>&lt;td&gt;&lt;span <span style="color: blue">DATAFLD</span>="LastName"&gt;&lt;/span&lt;/td&gt;</pre>
<pre>&lt;/tr&gt;</pre>
<pre>&lt;/table&gt;</pre>
<pre>&lt;/td&gt;&lt;/tr&gt;</pre>
<pre>&lt;/table&gt;</pre>
<pre>&lt;/td&gt;&lt;/tr&gt;</pre>
<pre>&lt;/table&gt;</pre>
<pre><strong><span style="color: purple">&lt;!--Here plug in the XML Data Island --&gt;</span></strong></pre>
<pre>&lt;/body&gt;</pre>
<pre>&lt;/html&gt;</pre>
<p>Displaying the XML Data retrieved on the IE</p>
<p>Now if you browse the <strong>AdoIsland.htm </strong>file the display should appear as follows. If you refer to the table above, you can see that although all fields are in the XML Data Island, only three of them are called while displaying.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml071.jpg" alt="adoxml071.jpg" /></p>
<p><span class="txt"><strong>Displaying the image saved as an embedded BMP file</strong></span></p>
<p>From the XML file you could retrieve the field for the &#8216;Photo&#8217; and display the image on the browser. For this, you need to add another cell to the table and insert the following for the cell.</p>
<pre><strong>&lt;td&gt;&lt;img src=""  DATAFLD="Photo"&gt;&lt;/td&gt;</strong></pre>
<p>With the above table cell added to the table, the display now appears as shown here. For this to display correctly you should have the corresponding BMP file at the same location as the AdoIsland.htm file.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/adoxml081.jpg" alt="adoxml081.jpg" /></p>
<p><span class="txt"><strong>Summary</strong></span></p>
<p>This tutorial extends the previous tutorial to show how to access data and display it using the ADO&#8217;s save() method. An example to display the persisted data using the XML Data Island was described. More importantly, the data types in MS Access as they relate to data types in the persisted XML file were shown in detail. Similar ideas will help in accessing data from a web server with Active Server Pages as well.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/11/displaying-ado-retrieved-data-with-xml-islands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Widgets</title>
		<link>http://www.programimi.com/2007/09/09/introduction-to-widgets/</link>
		<comments>http://www.programimi.com/2007/09/09/introduction-to-widgets/#comments</comments>
		<pubDate>Sun, 09 Sep 2007 00:52:40 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/09/introduction-to-widgets/</guid>
		<description><![CDATA[

Widget Walkthrough
A widget should be created to fill a need; it should actually do something useful.  What I decided on in the end was a news reader. Every day, when I turn on my computer, one of the first things I do is to go to the BBC news website and check out the [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><strong>Widget Walkthrough</strong></p>
<p>A widget should be created to fill a need; it should actually do something useful.  What I decided on in the end was a news reader. Every day, when I turn on my computer, one of the first things I do is to go to the BBC news website and check out the technology section headlines. I decided that my news reader would take the RSS feed supplied by the BBC and list the daily technology headlines. Thus the idea for TechFeeder was born.</p>
<p>The very first thing that I did was draw the main element of my widget in Photoshop (any decent graphic tool will do, but you won’t be able to use the Photoshop script if you use a different application). I won’t go into extreme detail over exactly what I did, but the tutorial I followed advised that aqua style icons are made using a layered mixture of shading, opacity and lighting effects. There are plenty of guides out there on aquifying pictures so if you’ve never created one before, I’d recommend searching for one and practicing a bit before the main event.</p>
<p>It took a couple of attempts before I had something that looked like I wanted it to, but soon enough I had the basic appearance that I had envisioned and settled with it. I think you’ll agree that while it isn’t perfect and has obvious flaws, it works reasonably well. Perhaps I’ll improve it for release 1.1 of my widget! While you have Photoshop open, you may as well create the image that you’ll use for the about-box for your widget. The about box should match the style of your widget if possible and list things such as the version number, author details and anything else you feel is appropriate. You can create the whole thing in Photoshop or just the background and use XML to add the text. It’s up to you, but in order to demonstrate some of the about-box capabilities, I just created the background in my image editor.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/widget_background.jpg" alt="widget_background.jpg" /></p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/widget_about.jpg" alt="widget_about.jpg" /></p>
<p><span class="txt">When you run the widget creation.jsx file, you’ll be asked to submit your name, the widget version and choose a location for the widget directory to be created.  Once it has finished, you’ll need to go into the contents folder and open the .kon file in a text editor.</span></p>
<p>You should be presented with some code that looks very similar to this:</p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;widget version=&#8221;1.0&#8243; minimumVersion=&#8221;2.0&#8243; author=&#8221;Dan Wellman&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;debug&gt;on&lt;/debug&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;window title=&#8221;TechFeeder&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;name&gt;mainWindow&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;width&gt;206&lt;/width&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;height&gt;141&lt;/height&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;visible&gt;1&lt;/visible&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;shadow&gt;0&lt;/shadow&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;/window&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;image src=&#8221;Resources/Shape 1.png&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;name&gt;Shape_1&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;hOffset&gt;0&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;vOffset&gt;5&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;width&gt;206&lt;/width&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;height&gt;136&lt;/height&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">  &lt;opacity&gt;70%&lt;/opacity&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/image&gt;</span></font></p>
<p>This should make sense at first glance to anyone who&#8217;s worked with XML before. The XML declaration comes first, followed by the &lt;widget&gt; tag which is the container into which all other tags must be placed. Next is the &lt;window&gt; tag, which in this case specifies the main window. Notice that the image that makes up the main background of the widget is specified in its own &lt;image&gt; block, separate from (not nested within) the window element. To make the widget semi-transparent, as many are, I’ve lowered the opacity of the image.  I have used a percentage here, but you could also use an integer from 0 to 255 to specify the opacity.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Introduction to Widgets &#8211; Adding Your Own Code</strong></span></span></p>
<p>Now you need to start adding code yourself. What I focused on first was the about-box, which is an element used solely to display a little window listing the program version, the creator, and anything else as a programmer that you want or need to display. As I’m using content from the BBC site, I felt it necessary to include their copyright information:</p>
<p style="text-align: justify"><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;about-box&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;image&gt;Resources/about-backg.png&lt;/image&gt;</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    </span></font></p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-version&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;12&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;vOffset&gt;45&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;/about-version&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;BBC TechFeeder&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;18&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">      &lt;vOffset&gt;30&lt;/vOffset&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;/about-text&gt;</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    </span></font></p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;Copyright:(C)&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;12&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;vOffset&gt;90&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;/about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;British Broadcasting Corporation&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;10&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;vOffset&gt;105&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;/about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;Click here for terms and conditions&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;url&gt;http://news.bbc.co.uk/1/hi/help/rss/4498287.stm&lt;/url&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;10&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;vOffset&gt;120&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;/about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;of reuse.&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;10&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">      &lt;vOffset&gt;130&lt;/vOffset&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;/about-text&gt;</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    </span></font></p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;By Dan Wellman&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;14&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;vOffset&gt;185&lt;/vOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;/about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">  &lt;about-text&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;2006&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;12&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#ffffff&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hOffset&gt;90&lt;/hOffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;vOffset&gt;200&lt;/vOffset&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;/about-text&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">  &lt;/about-box&gt;</span><span style="font-size: 11pt; font-family: Nimrod" lang="EN-GB"> </span><span style="font-size: 10pt; font-family: Nimrod" lang="EN-GB"> </span></font></p>
<p>It’s a whopping amount of code for one small window, most of which is graphic, but it’s easy code and should make absolute sense at a glance. The about-version code actually pulls the version number from the main kon file at run time. The reason it’s so large is that at present, text in the about-box doesn’t wrap and is simply cut off at the end of the window. This is why there are so many &lt;about-text&gt; blocks; each line is its own separate object. The &lt;about-version&gt; and &lt;about-text&gt; blocks are listed separately, much like the &lt;image&gt; element above.  Note that the about box must feature an image in order to function and that the bit of the text that is a hyperlink must have the &lt;url&gt; attribute set in the relevant code block. Once complete, the about box will appear like this:</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/widget_about2.jpg" alt="widget_about2.jpg" /></p>
<p><span class="txt"><span class="contentpagetitle"><strong>Introduction to Widgets &#8211; Displaying Data</strong></span></span></p>
<p>The application will be getting information from a news feed and it is going to need to display the information somewhere in order to carry out its function. I’ve created a text area to display the data for its multi-line facility, and I’ve enclosed it in a frame element primarily because of the automatic scrollbar capabilities that this element features:</p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;frame name=&#8221;dataframe&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;textarea name=&#8221;datatextarea&#8221;&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;data&gt;Loading…&lt;/data&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;font&gt;Arial&lt;/font&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;editable&gt;false&lt;/editable&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;color&gt;#000000&lt;/color&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;size&gt;12&lt;/size&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;style&gt;bold&lt;/style&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;height&gt;80&lt;/height&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;width&gt;150&lt;/width&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;voffset&gt;35&lt;/voffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;hoffset&gt;30&lt;/hoffset&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;bgcolor&gt;#cccccc&lt;/bgcolor&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">      &lt;bgopacity&gt;0&lt;/bgopacity&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;/textarea&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/frame&gt;</span></font></p>
<p>If you set the data element to hold the text “Loading…” this is what will be displayed when the widget first appears on screen. This is important because it takes a few seconds before the data is pulled through and parsed from the RSS feed. You’ll see in one of the functions later on that the data property of the text area is loaded after the source file has been obtained.</p>
<p>It’s great that the scroll bar handles, track and face are all drawn for you with absolutely no additional coding when using a frame element. You can also specify a frame element that will override this automaton and can be controlled via script.  Doing this is a bit beyond the scope of this article, but such an element could be used as part of a function that automatically scrolls the text displayed in the text area.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Introduction to Widgets &#8211; Setting the Preferences</strong></span></span></p>
<p>Next, I tackled the preferences. The widget engine will draw the preferences box for you and include the common options such as locking the widget&#8217;s position and setting the opacity. All you have to do is specify any additional options, and write the JavaScript to make them work:</p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;preference&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;name&gt;textfontpref&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;defaultValue&gt;Arial&lt;/defaultValue&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;title&gt;Text Font:&lt;/title&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;type&gt;font&lt;/type&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;description&gt;Select a font for the news text.&lt;/description&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/preference&gt;</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">  </span></font></p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;preference&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;name&gt;textcolorpref&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;defaultvalue&gt;#000000&lt;/defaultvalue&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;title&gt;Text Color:&lt;/title&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;type&gt;color&lt;/type&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;defaultValue&gt;#000000&lt;/defaultValue&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;description&gt;Select a colour for the news text.&lt;/description&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;/preference&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;preference&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;name&gt;textsizepref&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;defaultvalue&gt;12&lt;/defaultvalue&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;title&gt;Text Size:&lt;/title&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;type&gt;popup&lt;/type&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;8&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;10&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;12&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;14&lt;/option&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;description&gt;Select a font size for the news text.&lt;/description&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/preference&gt;</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">  </span></font></p>
<p style="text-align: justify"><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">&lt;preference&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;name&gt;textstylepref&lt;/name&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;defaultvalue&gt;Bold&lt;/defaultvalue&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;title&gt;Text Color:&lt;/title&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;type&gt;popup&lt;/type&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Bold&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Italic&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Narrow&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Expanded&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Condensed&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Smallcap&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Poster&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Compressed&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;Fixed&lt;/option&gt;<br />
</font><font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">    &lt;option&gt;No Style&lt;/option&gt;<br />
</font><font face="Courier"><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">    &lt;description&gt;Select a text style for the news text (it will only be applied if<br />
supported by the font).&lt;/description&gt;<br />
</span><span style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" lang="EN-GB">&lt;/preference&gt;</span></font></p>
<p>Widgets should be as customizable as possible; therefore, I’ve given the user control over everything that isn’t an image, which in this case is just the text from the BBC news feed. Each property you are able to change has its own segment of code. The &lt;type&gt; attributes of the first two preferences are used by the engine to automatically create a font chooser that previews all of your installed fonts, and a color picker, as seen in other applications.</p>
<p>In part two of this article I’ll show you how to wire up these preferences with a little bit of script to actually make them work. We’ll also work on the main script that makes the whole thing tick, and look at packaging and preparing the widget for upload to the online gallery.</p>
<p>&#8212;</p>
<p><em>By <font style="font-size: 11pt; font-family: 'Microsoft Sans Serif'" face="Courier" lang="EN-GB">Dan Wellman</font></em></p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/09/introduction-to-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roaming Through XMLDOM: An AJAX Prerequisite</title>
		<link>http://www.programimi.com/2007/09/07/roaming-through-xmldom-an-ajax-prerequisite/</link>
		<comments>http://www.programimi.com/2007/09/07/roaming-through-xmldom-an-ajax-prerequisite/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 18:36:33 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/07/roaming-through-xmldom-an-ajax-prerequisite/</guid>
		<description><![CDATA[

The twin tasks of the XMLHttp are handling the HTTP request, and then processing the XML response. The first one is easily done by writing the appropriate syntax for creating this object. This is what is accomplished in AJAX by invoking the new constructor for XMLHTTP object. This is but one of the objects of [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><span class="txt">The twin tasks of the XMLHttp are handling the HTTP request, and then processing the XML response. The first one is easily done by writing the appropriate syntax for creating this object. This is what is accomplished in AJAX by invoking the <strong>new </strong>constructor for XMLHTTP object. This is but one of the objects of the XMLDOM -XML <strong>D</strong>ocument <strong>O</strong>bject <strong>M</strong>odel. In this article, we look at XMLDOM in some detail before calling the XML document in an AJAX rendition in a future article.</span></p>
<p><span class="txt"><strong>A quick look at XMLDOM</strong></span></p>
<p>The DOM of HTML and XMLDOM share some common traits. The basic precept that documents are hierarchically structured with nodes and nested nodes is common to both of them. The DOM object model as seen in W3C documentation is described in full <a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#i-Document" rel="nofollow" target="_blank">here</a>.</p>
<p>XMLDOM can be understood through two types of metaphors, a tree representation and a family representation. In the tree representation, the tree has nodes. Nodes can have other nodes growing out of them, or a node can stand by itself without any other nodes sprouting from it. In the family metaphor you have parents, children, siblings, and so on.</p>
<p>Accessing XML via XMLDOM is facilitated by ActiveX. All that is needed is to create a new ActiveXObject, via the call:</p>
<p><strong><font face="Courier">var xml_doc=new ActiveXObject (&#8221;Microsoft.XMLDOM&#8221;); </font></strong></p>
<p>Once this is created, an XML document from a given location can be loaded. Then we can look at the various properties of this object as detailed in the XMLDOM. The following listing gives a brief description of the XMLDOM objects that are well suited for client side scripting.</p>
<p>In XMLDOM as well as HTML&#8217;s DOM the following interfaces are used for accessing. In the present tutorial we will only look at a subset of the properties and methods of the highlighted objects.</p>
<ul>    <font color="#333364" face="ARIAL" size="2"></p>
<li><strong>Attr </strong></li>
<li>CharacterData</li>
<li>Comment</li>
<li>DocumentFragment</li>
<li><strong>Document</strong></li>
<li>DOMException</li>
<li>DOMImplementation</li>
<li><strong>Element </strong></li>
<li><strong>Node </strong></li>
<li>NodeList</li>
<li>NamedNodeMap</li>
<li><strong>Text </strong></li>
<p></font></ul>
<p><strong><font size="3"> </font></strong><strong>Document</strong></p>
<p>Document is the root of the XML document.</p>
<p><strong>Element</strong>The element object represents the Document&#8217;s various elements, such as root and other elements.</p>
<p><strong>Node</strong>&#8220;Node&#8221; is a single node in the document tree representation. This has support for data types, namespaces, DTDs and XML Schemas.</p>
<p><strong>Attribute</strong>&#8220;Attribute&#8221; represents the single attribute node of an element.</p>
<p><strong>Text</strong>&#8220;Text&#8221; represents the text of an element or attribute.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Roaming through XMLDOM: An AJAX Prerequisite &#8211; Getting at the Innards of an XML Document</strong></span></span></p>
<p>We will briefly look at some of the XML Dom objects. In order to show how the code accesses the various parts of a document, consider the following well formed XML document <strong>WebClass.xml</strong> which is located on my hard drive at:</p>
<p><font face="Courier"><strong>C:/Documents and settings/computer user/Desktop/todo/Ajax/WebClass.xml</strong>.</font></p>
<p><strong>XML document probed</strong></p>
<pre>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;&lt;wclass&gt;

&lt;!-- My students who attended my web programming class --&gt;

&lt;student id="1"&gt;

&lt;name&gt;Linda Jones&lt;/name&gt;

&lt;legacySkill&gt;Access, VB5.0&lt;/legacySkill&gt;

&lt;/student&gt;

&lt;student id="2"&gt;

&lt;name&gt;Adam Davidson&lt;/name&gt;

&lt;legacySkill&gt;Cobol, MainFrame&lt;/legacySkill&gt;

&lt;/student&gt;

&lt;student id="3"&gt;

&lt;name&gt;Charles Boyer&lt;/name&gt;

&lt;legacySkill&gt;HTML, Photoshop&lt;/legacySkill&gt;

&lt;/student&gt;

&lt;student id="4"&gt;

&lt;name&gt;Charles Mann&lt;/name&gt;

&lt;legacySkill&gt;Cobol, MainFrame&lt;/legacySkill&gt;

&lt;/student&gt;

&lt;/wclass&gt;</pre>
<p><strong>Slicing the XML document</strong></p>
<p>First things first: we need to instantiate an XMLDocument object. This is done easily by running the following code as shown:</p>
<pre>&lt;SCRIPT LANGUAGE="JavaScript"&gt;var xml_doc = new ActiveXObject("Microsoft.XMLDOM");

xml_doc.async = false;

xml_doc.load ("C:/Documents and settings/computer user/Desktop/todo/Ajax/WebClass.xml");

&lt;/SCRIPT&gt;</pre>
<p>After this step we will look at a number of properities that can be accessed using code.</p>
<p><strong>First Child and Last Child Properties</strong></p>
<p>These properties can be accessed if you insert the following lines after loading the document as shown above but before &lt;/Script&gt;,</p>
<pre>document.write ("This documents first child is a " +xml_doc.documentElement.firstChild.nodeName);

document.write("&lt;br&gt;");

document.write ("This document's  last child= " +

xml_doc.documentElement.lastChild.nodeName);</pre>
<p>and if you display it in a browser you would see the following:</p>
<pre>This documents first child is a <strong>#comment</strong>This document's last child= <strong>student</strong></pre>
<p><span class="txt"></span></p>
<p id="intelliTxt"> <span class="contentpagetitle"><strong>Roaming through XMLDOM: An AJAX Prerequisite &#8211; Continuing the Dissection</strong></span><br />
<font face="Verdana"><strong>Document Element Properties</strong></font></p>
<p>The Document element has a <em>child nodes</em> collection you can access by iterating through the index. You can also access the <em>attributes,</em> which consist of a <strong>name</strong> and a <strong>value</strong> as shown here. The following code should be inserted after creating the XMLDOC object.</p>
<pre>document.write("&lt;br&gt;"+xdoc.documentElement.childNodes.item(0).text +"&lt;br&gt;");document.write("&lt;br&gt;"+xdoc.documentElement.childNodes.item(1).

attributes[0].name +"&lt;br&gt;");

document.write("&lt;br&gt;"+xdoc.documentElement.childNodes.item(1).

attributes[0].value +"&lt;br&gt;");</pre>
<p>When the above snippet is run you would see the following.</p>
<pre>My students who took web programming class with meid

1</pre>
<p><strong>Nodes Collection</strong></p>
<p>In the document we are looking at, we have a number of <em>student</em> nodes. We can get a reference to the <em>student</em> nodes using the <strong>getElementsByTagName</strong> method. From this we can find the number of such <em>student</em> nodes. Once we know how many there are (<em>nodes.length</em>), we can iterate through the collection and find the individuals as shown in the following code.</p>
<pre>var nodes=xdoc.getElementsByTagName("student");document.write("&lt;br&gt;Number of student nodes is "+nodes.length+"&lt;br&gt;");

for (i=0; i&lt; nodes.length; i++)

{document.write("&lt;br&gt;"+nodes.item(i).text+"&lt;br&gt;");}</pre>
<p>If you were to include the code in the script after instantiating the <strong>xdoc</strong> object you would see the following:</p>
<pre>Number of student nodes is 4Linda Jones Access, VB5.0

Adam Davidson Cobol, MainFrame

Charles Boyer HTML, Photoshop

Charles Mann Cobol, MainFrame</pre>
<h5><strong>Node&#8217;s name, type and value</strong></h5>
<p>Once you locate an element&#8217;s child node through its collection, as in the declaration of <strong>Elem</strong> in the next snippet, you could determine its name, type and value by calling respectively the <strong>nodeName</strong>, <strong>nodeType</strong> and <strong>nodeValue</strong> properties as shown.</p>
<pre>var Elem=xdoc.documentElement.childNodes.item(2);document.write("&lt;br&gt;"+Elem.nodeName+"&lt;br&gt;");

document.write("&lt;br&gt;"+Elem.nodeType+"&lt;br&gt;");

document.write("&lt;br&gt;"+Elem.nodeValue+"&lt;br&gt;");</pre>
<p>We have located the second child and its properties by running the above script as shown.</p>
<pre>student1

null</pre>
<h5><strong>Family metaphor related items</strong></h5>
<p>As mentioned earlier, in addition to the tree representation (tree metaphor) there is also the family representation (somewhat seniority based). These are usually parent, sibling, previous sibling, next sibling, and so on. The next few lines of code will give you an idea how we may access them. We will be starting with the second student whose id=2.</p>
<pre>//second student is referenced.var midElem = xdoc.documentElement.childNodes.item(2);

document.write("&lt;br&gt;"+midElem.attributes[0].value+"&lt;br&gt;");

document.write("&lt;br&gt;"+midElem.<strong>previousSibling</strong>.text+"&lt;br&gt;");

document.write("&lt;br&gt;"+midElem.<strong>nextSibling</strong>.text+"&lt;br&gt;");

document.write("&lt;br&gt;"+midElem.<strong>parentNode</strong>.nodeName+"&lt;br&gt;");

document.write("&lt;br&gt;"+midElem.parentNode.nodeType+"&lt;br&gt;");

document.write("&lt;br&gt;"+midElem.parentNode.nodeValue+"&lt;br&gt;");</pre>
<p>When the above code is inserted after instantiating xdoc as described previously, you would see the following displayed.</p>
<pre>2Linda Jones Access, VB5.0

Charles Boyer HTML, Photoshop

wclass

1

null</pre>
<p><span class="txt"><span class="contentpagetitle"><strong>Roaming through XMLDOM: An AJAX Prerequisite &#8211; Manipulating the XML Document</strong></span><br />
(Page 4 of 4 )</span></p>
<p>The XMLDOC object also has a large number of methods that can be invoked to create, modify, and delete nodes. The document object represents the XML file in its entirety and is also a node in the DOM. It has a large number of properties and many methods. For complete documentation the reader is referred to the W3C site. In addition to W3C there are also Microsoft extensions.</p>
<p><strong>Adding a new student to the web class</strong></p>
<p>Being a node, XMLDOC shares the properties of the nodes as well. A complete usage of the methods is not attempted, but a few examples are shown as related to the XML document we have been considering, the <strong>WebClass.xml</strong> file. XMLDOC object&#8217;s methods will be invoked to add another student to the web class file. This is what a student node looks like. We will add another student according to this scheme.</p>
<pre>&lt;student id="1"&gt;  &lt;name&gt;Linda Jones&lt;/name&gt;&lt;legacySkill&gt;Access, VB5.0&lt;/legacySkill&gt;

&lt;/student&gt;</pre>
<p>Looking at the node, student, we see that in order to add a new student node we need to add the <strong><em>name</em></strong> and <strong><em>legacySkill</em></strong> child nodes. Also we need to add the <strong><em>attribute</em></strong> Id and give a value to it. Finally we need to add the proper texts for the <strong>name</strong> and <strong><em>legacySkill</em></strong> nodes.</p>
<p>We assume that the new student will have:</p>
<p><font face="Courier">id &#8211;&gt; 7<br />
name&#8211;&gt;John Doe<br />
legacySkill&#8211;&gt;Fortran, Soroban</font>The code for adding the new student is as follows:</p>
<p><font face="Courier">//This creates a new student:<br />
var newElem= xdoc.createElement(&#8221;student&#8221;);</font></p>
<p><font face="Courier">//This line creates the <strong><em>attribute</em></strong> to the new student:<br />
var newAtt=newElem.setAttribute(&#8221;id&#8221;,7);</font></p>
<p><font face="Courier">//The next two lines creates elements <em><strong>name</strong></em> and <strong><em>legacySkill</em></strong><br />
var part1=xdoc.createElement(&#8221;name&#8221;);<br />
var part2=xdoc.createElement(&#8221;legacyskill&#8221;);</font></p>
<p><font face="Courier">//The next two lines create the required <strong><em>text</em></strong> for the nodes:<br />
var newText1=xdoc.createTextNode(&#8221;John Doe &#8220;);<br />
var newText2=xdoc.createTextNode(&#8221;Fortran, Soroban&#8221;);</font></p>
<p><font face="Courier">//Appending the <em><strong>name</strong></em> and <strong><em>legacySkill</em></strong> to the student node<br />
var part11=newElem.appendChild(part1);<br />
var part21=newElem.appendChild(part2);</font></p>
<p><font face="Courier">//Adding the text content to the name and legacySkill nodes<br />
part11.appendChild(newText1);</font></p>
<p><font face="Courier">part21.appendChild(newText2);</font></p>
<p>In this fashion you build the tree so that the node is defined according to the blueprint from the XML document. This completes the building of the <em>student</em> node.</p>
<p><strong>Verifying the new student information</strong></p>
<p>In order to verify, we again invoke the XMLDOC&#8217;s properties as shown in the early part of this tutorial. In particular we will be using the following code to verify:</p>
<p>//<em>We created newElem and the node&#8217;s name is given by:</em> <font face="Courier">document.write(newElem.nodeName);</font></p>
<p>//<em>We get the following result for this line:<br />
</em><strong><font size="3">student</font></strong></p>
<p>//<em>We have not added the <strong>newElem</strong> to <strong>xdoc</strong> and presently the number of</em> //<em>nodes in <strong>xdoc</strong> are given by:</em><br />
<font face="Courier">var totalnodes=xdoc.getElementsByTagName(&#8221;student&#8221;);<br />
document.write(&#8221;&lt;br&gt;&#8221;+totalnodes.length);</font></p>
<p>//<em>the result of this code gives the number of student nodes in xdoc:<br />
</em><strong><font size="3">4</font></strong></p>
<p>//<em>We look at the attributes of the new student node:</em><br />
<font face="Courier">document.write(&#8221;&lt;br&gt;&#8221;+ newElem.attributes[0].name);<br />
document.write(&#8221;&lt;br&gt;&#8221;+ newElem.attributes[0].value);</font></p>
<p>//<em>We get the following result for the above code snippet:<br />
</em><strong><font size="3">id<br />
7</font></strong></p>
<p>//<em>We now grab the text for the entire student node:</em><br />
<font face="Courier">document.write(&#8221;&lt;br&gt;&#8221;+newElem.text);</font></p>
<p>//<em>This snippet gives the following browser display:<br />
</em><strong><font size="3">John Doe Fortran, Soroban</font></strong></p>
<p>//<em>Now we get a reference to the last child of the xdoc before adding the</em> //<em>new student:</em><br />
<font face="Courier">var lastnode=xdoc.lastChild;</font></p>
<p>//<em>This is important. We add the newElem student node to the xdoc:</em><br />
<font face="Courier">lastnode.appendChild(newElem);</font></p>
<p>//<em>We now count the number of nodes in the new document which have</em> //<em>the student nodes:</em><br />
<font face="Courier">var totalnodes=xdoc.getElementsByTagName(&#8221;student&#8221;);<br />
document.write(&#8221;&lt;br&gt;&#8221;+totalnodes.length);</font></p>
<p>//<em>The result of this in the browser display is:<br />
</em><strong><font size="3">5 </font></strong></p>
<p>This verifies that the new student has been added (we started out with 4). The file can be saved using the <strong>save (ObjTarget)</strong> method of the XMLDOC object.</p>
<p><strong>Summary</strong></p>
<p>Understanding and manipulating the XMLDOM objects is a prerequisite to writing successful code, whether it be for AJAX or for anything to do with XML files especially using Microsoft tools. It is the author&#8217;s hope that the surgical presentation of this tutorial in dissecting the XMLDOM object will provide a guide to this understanding. XMLHTTP request is another object belonging to the XMLDOM; it is discussed in a <a href="http://www.programimi.com/2007/09/07/step-by-step-to-ajax/">previous</a> tutorial and will be revisited again in discussing the responseXML method of the request object.</p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/07/roaming-through-xmldom-an-ajax-prerequisite/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Step by Step to AJAX</title>
		<link>http://www.programimi.com/2007/09/07/step-by-step-to-ajax/</link>
		<comments>http://www.programimi.com/2007/09/07/step-by-step-to-ajax/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 18:20:57 +0000</pubDate>
		<dc:creator>ProCOM</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.programimi.com/2007/09/07/step-by-step-to-ajax/</guid>
		<description><![CDATA[

AJAX has been exciting many programmers as the latest and greatest thing in web development. This article takes a step-by-step look at the Microsoft way to script for AJAX.
Introduction This tutorial is not about Ajax Telamon from the Iliad who fought Hercules, but the latest and greatest (at least in the opinion of some) thing [...]]]></description>
			<content:encoded><![CDATA[<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace aboveboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>
<p><span class="txt">AJAX has been exciting many programmers as the latest and greatest thing in web development. This article takes a step-by-step look at the Microsoft way to script for AJAX.</span></p>
<p><span class="txt"><strong>Introduction </strong>This tutorial is not about Ajax Telamon from the <em>Iliad</em> who fought Hercules, but the latest and greatest (at least in the opinion of some) thing in web development. Ever since Google charmed the web at large with those AJAX-created Google Maps apps, the number of amount of adherence to AJAX has been growing exponentially. In this tutorial, we look mainly at the Microsoft way of scripting for AJAX.  Like my previous tutorials, it&#8217;s step by step all the way after a brief introduction.</span></p>
<p><strong>Web Application Evolution</strong>Since 1992 developers have relentlessly pursued ways to  make the web more appealing, more productive and more interactive. The plain text html at birth soon saw embedded images followed by appealing colors conferred by cascading style sheets. But it was left for JavaScript to bring user interaction, and thus began the heydays of scripting languages.</p>
<p>However, there were two major browsers sharing the web space, and two scripts to serve the user (the third, ECMA came later). This was not enough, and DHTML was born &#8211; not a new language, but a good mix of html, CSS, and JavaScript that made user interaction extremely satisfying.</p>
<p>AJAX came along to make the interaction more responsive without needing to refresh the page. AJAX is an acronym, and the credit for coining this name goes to Adaptive Path&#8217;s S. S. Garret. However, Microsoft appears to be the progenitor, with its flagship ActiveX Technology making this possible. Now it is a mélange of XHTML, CSS, JavaScript, XmlHttpRequest, and XML, and its DHTML <strong>déjà vu</strong> all over.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Step by Step to AJAX &#8211; Ajax&#8217;s Model of Interaction</strong></span></span></p>
<p>The figure shown next is derived from Garret&#8217;s article on Ajax, redrawn to render it horizontally. The figure shows both the prior art (classic interaction) as well as the AJAX embodiment. In the classic version, the client sends an HTTP(S) request to the server, the server checks to see whether any server side processing is to be carried out, processes the server related instructions and sends back the html with CSS, if it is defined. There is a synchronicity between client request and server response.</p>
<p>In the AJAX model, the client sends a JavaScript to AJAX, and AJAX sends the HTTP(S) request to the web server which can also serve XML. The web/XML server sends back the result in the form of XML, and AJAX relies on the Document Object Model (DOM: blue print of web document) to transmit the result in XHTML and CSS. It does so by reading the returned XML&#8217;s node tree using DOM. The interaction could be synchronous or asynchronous.</p>
<p><img src="http://www.programimi.com/wp-content/uploads/2007/09/ajaxnew2.JPG" alt="AJAX" /></p>
<p><span class="txt"><span class="contentpagetitle"><strong>Step by Step to AJAX &#8211; XmlHttpRequest</strong></span></span></p>
<p>One of the key objects needed for working with AJAX is the XMLHttpRequest Object. This object does two things: it handles the httpRequest, and then it processes the XML response. This was implemented in Internet Explorer 5 for Windows as an ActiveX Object. This has been implemented by Mozilla 1.0, Apple and others in compatible forms. The W3C has similar standards for the DOM Level 3 specification. We will take a brief look at this object before we put it to work. Some of the highlighted methods and properties are later used while fetching a web page to show what values they do return.</p>
<p><strong>Creating the XML HttpRequest object</strong>This is the easy part, if you need to deal only with Microsoft IE. For Mozilla you would instantiate the object using the following syntax:</p>
<p><strong>var xhr=new XMLHttpRequest();</strong></p>
<p>where as for IE you would use the following:</p>
<p><strong>var xhr=new ActiveXObject(&#8221;Microsoft.XMLHTTP&#8221;);</strong></p>
<p>Both of these methods create an object which is hidden from the user. Its methods and properties take control of the server interaction. For cross browser applications you need to come up with a branching syntax. This is not so difficult; see for example the <a href="http://www-128.ibm.com/developerworks/library/j-ajax1/" rel="nofollow">cross-browser boiler plate code (Listing 2.0 in the link)</a>.</p>
<p><span class="txt"><span class="contentpagetitle"><strong>Step by Step to AJAX &#8211; XMLHttpRequest Object Methods</strong></span></p>
<p></span></p>
<p>This short list of methods is shared by all supported browsers. In this tutorial we shall look at some of the highlighted methods.</p>
<dl>
<dt>abort() </dt>
<dd>current request is stopped </dd>
<dt><strong>getAllResponseHeaders()</strong> </dt>
<dd>returns a string containing information of headers </dd>
<dt>getResponseHeader (&#8221;headerlabel&#8221;) </dt>
<dd>returns a string containing information about a single header </dd>
<dt><strong>open(&#8221;method&#8221;, &#8220;URL&#8221;[,asyncFlag[,"userName"[,"password"]]])</strong> </dt>
<dd>assigns various request attributes </dd>
<dt><strong>send(content)</strong> </dt>
<dd>Transmits the data with information that may be posted, if needed </dd>
<dt>setRequestHeader (&#8221;label&#8221;, &#8220;value&#8221;) </dt>
<dd>assigns label, value pair for the header </dd>
</dl>
<p>While open() and send() are most often used, the others are also useful in some cases. The open() method begins the interaction and takes two mandatory arguments; the &#8220;method&#8221; used to open, which is either GET or POST, and the URL to which the request is made.</p>
<p>The GET and POST methods are similar to those used in ASP, as some of you might recognize. The GET is indicated for retrieving read only data while POST is for sending data to the server.</p>
<p>The URL could be complete, or a relative URL.</p>
<p>The third parameter which is optional (default value TRUE being asynchronous) sets the interaction to be synchronous (FALSE) or asynchronous (TRUE). If you choose the synchronous route, the script waits for the response to arrive before acting. The useful mode is to set the interaction to be asynchronous and use the  onreadystatechange event (to be discussed) to get at the response.</p>
<p><strong>XMLHttpRequest Object Properties</strong>The following read only properties are browser agnostic (all supported browsers understand them).</p>
<dl>
<dt><strong>onreadystatechange</strong> </dt>
<dd>Event handler which fires every time the state changes </dd>
<dt><strong>readState</strong> </dt>
<dd>Integer representing the status of the object<br />
0 = uninitialized<br />
1 = loading<br />
2 = loaded<br />
3 = interactive<br />
4 = complete </dd>
<dt><strong>responseText</strong> </dt>
<dd>Data returned in string format </dd>
<dt>responseXML </dt>
<dd>Data returned in DOM Compatible format </dd>
<dt><strong>status</strong> </dt>
<dd>Numeric code returned by server indicating status<br />
404: Not found<br />
200: OK </dd>
<dt><strong>statusText</strong> </dt>
<dd>Message string that came with the status </dd>
</dl>
<p><span class="txt"><span class="contentpagetitle"><strong>Step by Step to AJAX &#8211; Fetching a page using AJAX</strong></span></p>
<p>Working with AJAX is quite simple. The code will be explained by explaining the component parts with reference to an html file, <strong>AjaxTest.htm</strong>. First you need to create an XMLHttpRequest Object along the lines discussed above. Then you make a request, in this case pass an URL as an argument to the getPage() function. Since you are getting back a page you just need to use the GET argument. Since an asynchronous interaction is intended, use TRUE for the third argument in the open() method.</p>
<p>Before the open() method is called the onreadystatechange eventhandler calls the statusCheck() function, where the readyState of the request is verified and the status code is verified to return OK. Both of these functions are in the &lt;Head/&gt; and are evaluated before the rest of the page is loaded. Review the two functions just described for the html page <strong>AjaxTest.htm</strong>. Some of the properties and methods previously described and highlighted are also returned. The script that follows this paragraph is in the &lt;head/&gt; section of AjaxTest.htm.</p>
<p>You also include code to alert you if, for some reason, the XMLHttpRequest object instantiation failed. It also needs to alert the user if the request failed because the page was unavailable, or the server was not responding, or for any other reason.</p>
<p>If the status is OK and the readyState shows completion, then you get the response, for this example, in the text format. Now you invoke the DOM API to get the element whose ID=&#8221;x&#8221;, in this case the &lt;div/&gt;, and set its innerHTML property the same as the returned text. If you look at the response produced by the <em>alert(xhr.responseText)</em> you would see the html of the page you requested as shown in the next picture. I particularly like the preference to use the ECMA scripting style.</p>
<pre>&lt;SCRIPT LANGUAGE=javascript&gt;
&lt;!--
var xhr = false;
function getPage (url) {
xhr = false;
//this is the Microsoft browser compatible instantiation
xhr = new ActiveXObject("Microsoft.XMLHTTP");
if (!xhr) {
alert ('XMLHttpRequest failed to instantiate');
return false;
}
xhr.onreadystatechange = statusCheck;
xhr.open ('GET', url, true);
xhr.send (null);
}
function statusCheck() {
txt1.value="XmlHttpRequest_Status: " + xhr.status;
txt2.value="XmlHttpRequest_readyState: " + xhr.readyState;
TEXTAREA1.value="XmlHttpRequest_getallResponseHeaders(): " +
xhr.getAllResponseHeaders();
txt5.value="XmlHttpRequest_statusText: " + xhr.statusText
if (xhr.readyState == 4) {
if (xhr.status == 200) {
alert(xhr.responseText);
document.getElementById("x").innerHTML =(xhr.responseText);
} else {
alert ('There was a problem with the request.');
}
}
}
//--&gt;
&lt;/SCRIPT&gt;</pre>
<p></span></p>
<p style="text-align: center"><img src="http://www.programimi.com/wp-content/uploads/2007/09/alert.jpg" alt="Alert" /></p>
<p><span class="txt">However, when you use the DOM API, you get the following as shown:</span></p>
<p style="text-align: center"><img src="http://www.programimi.com/wp-content/uploads/2007/09/ajaxtest.jpg" alt="AJAX Test" /></p>
<p><span class="txt">The &lt;body/&gt; of the <strong>AjaxTest.htm</strong> consists of just the following controls so that the properties, the methods and their values can be displayed. The onclick event starts the process rolling. Of course the &lt;div/&gt; is where the innerHTML property gets written. The html for these controls is as shown:</p>
<pre>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN
style="FONT-SIZE: large; COLOR: red"&gt;A&lt;/SPAN&gt;synchronous &lt;SPAN
style="FONT-SIZE: large; COLOR: red"&gt;J&lt;/SPAN&gt;avascript &lt;SPAN
style="FONT-SIZE: large; COLOR: red"&gt;A&lt;/SPAN&gt;nd &lt;SPAN
style="FONT-SIZE: large; COLOR: red"&gt;X&lt;/SPAN&gt;ML= &lt;SPAN
style="FONT-SIZE: large; COLOR: blue"&gt;AJAX&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;INPUT id=button1 type=button
onclick="getPage ('http://xphtek/TestXMLHttp/Greeting.asp')"
value="Get the page by XmlHttpRequest" name=button1&gt;&lt;/P&gt;
&lt;P&gt;&lt;INPUT id=txt1 style="WIDTH: 396px; HEIGHT: 22px" size=51&gt;&lt;/P&gt;
&lt;P&gt;&lt;INPUT id=txt2 style="WIDTH: 395px; HEIGHT: 22px" size=50&gt;&lt;/P&gt;
&lt;P&gt;&lt;TEXTAREA id=TEXTAREA1 style="WIDTH: 393px; HEIGHT: 72px"
name=TEXTAREA1 cols=42&gt;&lt;/TEXTAREA&gt;&lt;/P&gt;
&lt;P&gt;&lt;INPUT id=txt5 style="WIDTH: 389px; HEIGHT: 22px"
size=50&gt;&lt;/P&gt;
<strong>&lt;div id="x"&gt;&lt;/div&gt;</strong></pre>
<p>As previously mentioned you can reference the URL completely, as in <em>http://xphtek/TestXMLHttp/Greeting.asp</em> or simply by its relative URL <em>Greeting.asp</em>. The Greeting.asp page is a simple page as shown:</p>
<pre> &lt;%@ Language=VBScript %&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"&gt;
&lt;script language="javascript"&gt;
document.write (document.lastModified);
&lt;/script&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;%Response.Write("&lt;b&gt;Welcome to programming with AJAX&lt;/b&gt;")%&gt;&lt;br&gt;
&lt;% =Date()%&gt;&lt;br&gt;
Hello&lt;br&gt;</pre>
<p>&lt;/BODY&gt;<br />
&lt;/HTML&gt;</p>
<p><strong>Summary </strong>The tutorial has looked at the various properties and methods of this interesting XMLHttpRequest object. It goes without saying that the browser should support JavaScript, and as a developer you should appropriately warn the user to enable JavaScript, if it is not. For Microsoft IE there is the additional requirement of browser support for ActiveX objects.</p>
<p>For recent browsers the older method of using <em>iframes</em> to update parts of a page will be replaced. However <em>iframes</em> may still find favor with much older browsers. In this tutorial we saw most of the properties, but the lastmodified property returned null; the syntax was double checked but to no avail. Although AjaxTest.htm was coded on Visual Interdev 6.0, it is not a requirement; plain Notepad should work as well.</p>
<p></span></p>

<!-- Chitika|Premium - WordPress Plugin --><div class="chitika-adspace belowboth"><script type="text/javascript"><!--
ch_client = "procom";
ch_type = "mpu";
ch_width = 550;
ch_height = 120;
ch_color_bg = "";
ch_color_title = "8F0222";
ch_color_site_link = "8F0222";
ch_color_text = "";
ch_non_contextual = 4;
ch_vertical = "premium";
ch_font_title = "";
ch_font_text = "";
ch_sid = "procom";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.programimi.com/2007/09/07/step-by-step-to-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
