<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Blog of Shaun McCran - Architecting robust, elegant technical and business solutions - HTML</title>
			<link>http://www.mccran.co.uk/index.cfm</link>
			<description>I write about Architecture and Design, Architectural patterns, Architectural Principles and Architectural policies. This includes TOGAF, Zachman, Business Architecture, SOA and Process and tools such as the IBM Rational software and Adobe products. I also write about my previous life as a mobile and web developer.</description>
			<language>en-gb</language>
			<pubDate>Tue, 09 Jun 2026 06:48:16 -0000</pubDate>
			<lastBuildDate>Sun, 14 Aug 2011 09:11:00 -0000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>shaun@mccran.co.uk</managingEditor>
			<webMaster>shaun@mccran.co.uk</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>shaun@mccran.co.uk</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			
			
			
			
			<item>
				<title>Creating a baseline  HTML 5 document</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/8/14/Creating-a-baseline--HTML-5-document</link>
				<description>
				
				Browser standards and cutting edge web design are not great bedfellows. I&apos;ve heard the arguments from creative designers that you have to write specific browser CSS styles to accommodate the multitude of browsers and their own unique way of rendering CSS. 

I disagree. I firmly believe that with a good understanding of the structure of CSS elements and how they interact with each other you can develop a completely cross-browser non JavaScript baseline template. This article explains how I have approached creating a HTML 5 layout file, that works across legacy browsers just as well as the more modern interpreters.
				 [More]
				</description>
				
				
				<category>Best practices</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Sun, 14 Aug 2011 09:11:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/8/14/Creating-a-baseline--HTML-5-document</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using JQuery to disable all form fields</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/12/23/Using-JQuery-to-disable-all-form-fields</link>
				<description>
				
				Whilst writing a new timesheet application I added a function to &apos;lock&apos; an entire dataset, IE stop a user from editing the form on the page.
&lt;p&gt;
I&apos;d spent a lot of time layout the timesheet page, designing the form, and help text etc. I didn&apos;t really want to destroy the visuals if a record was locked, I wanted it just the same, but &apos;non-active&apos;.
&lt;p&gt;
This is where JQuery is simply awesome. Understanding &apos;selectors&apos; and the power they can give you, with only very simple construction is key.
&lt;p&gt;
In this example imagine a page that has a div within it, the div has a id of &apos;divLabel&apos;. Within that div there is a form. The code below will disable all the input elements within that div. Every single one of them. In one line of code. How cool is that.
&lt;p&gt;
&lt;code&gt;
&lt;s/cript type=&quot;text/javascript&quot;&gt;
	$(document).ready(function(){
		$(&apos;#divLabel :input&apos;).attr(&apos;disabled&apos;, true);
	});
	// end
&lt;/script&gt;
&lt;/code&gt;
&lt;p&gt;
What its actually doing is adding the disabled attribute to each input, then setting the value to &apos;true&apos;.
&lt;p&gt;
Get familiar with how JQuery selectors work, the docs are here: &lt;a href=&quot;http://api.jquery.com/category/selectors/&quot; target=&quot;_blank&quot;&gt;http://api.jquery.com/category/selectors/&lt;/a&gt;
&lt;p&gt;
				
				</description>
				
				
				<category>JQuery</category>
				
				<category>HTML</category>
				
				<pubDate>Thu, 23 Dec 2010 16:05:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/12/23/Using-JQuery-to-disable-all-form-fields</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Showing and hiding Divs using JQuery and a select field</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/12/16/Showing-and-hiding-Divs-using-JQuery-and-a-select-field</link>
				<description>
				
				Ever want to show and hide div elements using form controls? JQuery makes this sort of functionality super easy.
&lt;p&gt;
In this blog entry I&apos;ll show you how to create a simple JQuery function that shows and hides elements based on a form select field. 
&lt;p&gt;
You can see an example of the finished script here: &lt;a href=&quot;http://www.mccran.co.uk/examples/jquery_select_field/&quot; target=&quot;_blank&quot;&gt; Demo JQuery show / hide using a select field&lt;/a&gt;
&lt;p&gt;
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>HTML</category>
				
				<pubDate>Thu, 16 Dec 2010 15:30:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/12/16/Showing-and-hiding-Divs-using-JQuery-and-a-select-field</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Fck editor inserting xhtml and browser specific code</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/6/3/Fck-editor-inserting-xhtml-and-browser-specific-code</link>
				<description>
				
				I&apos;ve been using the fck editor to handle my rich text areas in a content management application. I have to say I like the way it works, and it integrates easily with a Coldfusion platform. It does however have a few issues. This article deals with fck editor using xhtml code, and the editor using a few browser specific html rewrites.

Note: I can&apos;t have xhtml code in my site, as the definition type is not xhtml, and it fails an accessibility check if any is present.
				 [More]
				</description>
				
				
				<category>Coldfusion</category>
				
				<category>Accessibility</category>
				
				<category>HTML</category>
				
				<pubDate>Thu, 03 Jun 2010 10:47:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/6/3/Fck-editor-inserting-xhtml-and-browser-specific-code</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Strict or Transitional DTD type validation, worth hacking just to pass?</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/1/22/Strict-or-Transitional-DTD-type-validation-worth-hacking-just-to-pass</link>
				<description>
				
				An area of web development that I previously had little exposure to was WCAG validation. This is the industry standard for Accessibility coding for web platforms. For version two (V2) of the WCAG there are three standards, A, AA and triple A (AAA). Each represents different levels of Accessible compatibility.

What this also does is validate against the W3C doctype standards. This is where my problems arose. The main aim of the doctype standard is to clearly define a separation layer between content and behaviour. In practical terms this equates to best practices such as having an external .CSS files rather than inline styling, and declaring the language types for scripting, such as JavaScript etc.

Using a free online tool, &lt;a href=http://www.totalvalidator.com/ target=_blank&gt;http://www.totalvalidator.com/ &lt;/a&gt; you can check if your site is W3C and WCAG complaint. It will base the validation on the doctype declared in your html. There are three types of DTD declaration for html 4.01.

&lt;code&gt;

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/frameset.dtd&quot;&gt;

&lt;/code&gt;

You can read more about Doctypes here: &lt;a href= http://www.w3schools.com/tags/tag_DOCTYPE.asp target=_blank&gt; http://www.w3schools.com/tags/tag_DOCTYPE.asp&lt;/a&gt;

The main difference between these is that the frameset DTD will accept frameset as valid html, whereas the others will not. Also the Strict DTD imposes a very tight restriction of what is accepted as valid in comparison to the Transitional DTD. One is a Strict adherance to the standard, whereas the other shows that you are Transitioning from old code into the new.

The site &lt;a href= http://24ways.org/2005/transitional-vs-strict-markup target=_blank&gt; http://24ways.org/2005/transitional-vs-strict-markup&lt;/a&gt; goes into more detail about what the exact differences are, what I am going to discuss is the option of creating functional hacks, merely to pass validation.

One of the deprecated attributes in Strict validation is the target attribute.

&lt;code&gt;
&lt;a href=http://www.mywebsite.com target=_blank&gt;Follow this link to go to my website&lt;/a&gt;
&lt;/code&gt;

We are all familiar with this attribute, but when you examine it you find that it is actually a declaration of behaviour. We are forcing the user into a specific action. IE open a new window. As a best practice guideline whenever we have a link on a site that exits that site, we open a new window. The only work around for this is creating a specific JavaScript function to open a new window, as this will not be marked as invalid. This seems overkill, just to pass validation.

So I am left with the dilemma that if I want my sites to pass Strict DTD validation I must create a JavaScript hack, or compromise the functionality. I&apos;d like to pass the validation, but I view the functionality as key to a site, so it&apos;s an easy decision for me.
				
				</description>
				
				
				<category>Best practices</category>
				
				<category>Accessibility</category>
				
				<category>Javascript</category>
				
				<category>HTML</category>
				
				<category>Web technologies</category>
				
				<pubDate>Fri, 22 Jan 2010 12:34:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/1/22/Strict-or-Transitional-DTD-type-validation-worth-hacking-just-to-pass</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Creating a CSS only cross browser drop down menu</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/1/8/Creating-a-CSS-only-cross-browser-drop-down-menu</link>
				<description>
				
				I&apos;ll say this up front, I&apos;m not a CSS guru. I like CSS, but it can be incredibly frustrating. One of the clients I am currently producing work for requires a high level of Accessibility. High enough that we need to avoid using JavaScript unless any script has a &quot;Non&quot; JavaScript equivalent.

The site navigation is through a top level horizontal menu, but what if we also want a drop down menu? Can we do it in CSS only, and it still be Firefox, Internet Explorer 6,7 and 8 compatible? 

Yes, we can, but it&apos;s a lot of code, and it&apos;s not pretty. The basic concept behind most CSS menus is to use a list, and transform each list item to suit your styling. So we will create a div, with a class of menu. Then create a list inside it.

&lt;code&gt;
	&lt;div class=&quot;menu&quot;&gt;
		&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;&quot;&gt;Top menu option
		&lt;!--[if IE 7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;
		&lt;!--[if lte IE 6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;
	
		&lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 1&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 2&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 3&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 4&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 5&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 6&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;

			&lt;!--[if lte IE 6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/a&gt;&lt;![endif]--&gt;
		&lt;/li&gt;
		
		&lt;/ul&gt;
	
	&lt;/div&gt;
&lt;/code&gt;

Notice that there are some specific if statements relating to different versions of Internet Explorer. these basically make the functionality the same for each version, they are compensating for the differences in code handling between IE versions.

Next create a set of CSS styles to alter the appearance of the list. I am not going to go into the CSS line by line, as it is commented, but I&apos;ll explain the methodology behind it.

The top level menu item is always displayed, but the list is hidden using &quot;visibility:hidden&quot;. When the user mouse&apos;s over the menu div the CSS applies a:hover ul{visibility:visible;. This makes the list visible. 

&lt;code&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;

.menu {width:149px; height:32px; position:relative; z-index:100;border-right:1px solid #000; font-family:arial, sans-serif;}

/* hack to correct IE5.5 faulty box model */
* html .menu {width:149px; w\idth:149px;}

/* remove all the bullets, borders and padding from the default list styling */
.menu ul {padding:0;margin:0;list-style-type:none;}
.menu ul ul {width:149px;}

/* float the list to make it horizontal and a relative position so that you can control the dropdown menu positon */
.menu li {float:left;width:149px;position:relative;}

/* style the links for the top level */
.menu a, .menu a:visited {display:block;font-size:12px;text-decoration:none; color:#fff; width:138px; height:30px; border:1px solid #000; border-width:1px 0 1px 1px; background:#c0c0c0; padding-left:10px; line-height:29px; font-weight:bold;}

/* a hack so that IE5.5 faulty box model is corrected */
* html .menu a, * html .menu a:visited {width:149px; w\idth:138px;}

/* style the second level background */
.menu ul ul a.drop, .menu ul ul a.drop:visited {background:#c0c0cc url(arrow.gif) no-repeat 130px center;}

/* style the second level hover */
.menu ul ul a.drop:hover{background:#c0c0cc url(arrow.gif) no-repeat 130px center;}
.menu ul ul :hover &gt; a.drop {background:#c0c0cc url(arrow.gif) no-repeat 130px center;}

/* hide the sub levels and give them a positon absolute so that they take up no room */
.menu ul ul {visibility:hidden;position:absolute;height:0;top:31px;left:0; width:149px;border-top:1px solid #000;}

/* another hack for IE5.5 */
* html .menu ul ul {top:30px;t\op:31px;}

/* style the table so that it takes no part in the layout - required for IE to work */
.menu table {position:absolute; top:0; left:0; border-collapse:collapse;}

/* style the second level links */
.menu ul ul a, .menu ul ul a:visited {background: ghostwhite; color:#000; height:auto; line-height:1em; padding:5px 10px; width:128px;border-width:0 1px 1px 1px;}

/* yet another hack for IE5.5 */
* html .menu ul ul a, * html .menu ul ul a:visited {width:150px;w\idth:128px;}

/* style the top level hover */
.menu a:hover, .menu ul ul a:hover{color:#000; background:#c0c0cc;}
.menu :hover &gt; a, .menu ul ul :hover &gt; a {color:#000; background:#c0c0cc;}

/* make the second level visible when hover on first level list OR link */
.menu ul li:hover ul,
.menu ul a:hover ul{visibility:visible;}
&lt;/code&gt;

There are also a lot of other browser specific hacks present, as the aim was to get the menu working in every Internet Explorer version, and be Accessible.

There is a demo of this here: &lt;a href=&quot;http://www.mccran.co.uk/css/demo.cfm&quot; target=&quot;_blank&quot;&gt;CSS menu demo&lt;/a&gt;
				
				</description>
				
				
				<category>Internet Explorer</category>
				
				<category>Accessibility</category>
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 08 Jan 2010 16:47:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/1/8/Creating-a-CSS-only-cross-browser-drop-down-menu</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>My handy IE CSS tweaks list</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/12/18/My-handy-IE-CSS-tweaks-list</link>
				<description>
				
				I&apos;m not really a design kind of person, I like designing things, and I&apos;m learning more and more CSS all the time, but it&apos;s the server side coding that I love like Apple Pie and custard.

Recently I&apos;ve had to do a bit more design work, so I&apos;ve been tripping all over myself to get CSS working in IE6,IE7,IE8 and firefox. I&apos;ve learnt a few interesting things in the last few days, and I know I&apos;m going to need to use them again. Some are considered &apos;hacks&apos;, some are just clever CSS techniques. They all feel a bit like secret rules of a club I&apos;m not really a member of yet though.

So I&apos;m making a handy list, so I don&apos;t loose them. I hope to refine and add to this on an ongoing basis, so if you know a better / easier way please let me know. After all coding standards are for life, not just Christmas, and I don&apos;t like the idea of anything being a hack, even if it is CSS.

&lt;h3&gt;Adding a 1px high line to IE&lt;/h3&gt;
I am trying to add a 1px line, like a HR line to the page, it displays fat in IE?

It seems that some versions of IE will display a div without content as the same height as your font size. Add html comments to it to drop it down to the right height:
&lt;code&gt;
&lt;style&gt;
.yellow-ruler {color: #ffd520; background-color:#ffd520; width: 100%; height:2px; margin: 3px 0px 0px 0px;}
&lt;/style&gt;
&lt;div class=&quot;yellow-ruler&quot;&gt;&lt;!-- --&gt;&lt;/div&gt;
&lt;/code&gt;

&lt;h3&gt;IE is adding padding and margins to everything by default&lt;/h3&gt;

I think there is a lot more information about this out there, but for now I&apos;ve found that adding the code below will kill most of IE&apos;s random padding/margin issues.

&lt;code&gt;
* {margin:0; padding:0; border: 0px;}
&lt;/code&gt;

&lt;h3&gt;I&apos;ve built a JQuery accordion and the content doesn&apos;t move correctly&lt;/h3&gt;

When expanding a JQuery accordion element the content underneath it is not moving down, and the accordion is expanding over it. This was a simple fix, but a bit of a pain to find. Just do not specify a height attribute on the div that hold the accordion, IE will stick to the height, but firefox will let it grow to be longer.

&lt;h3&gt;Styling form element borders&lt;/h3&gt;

If you have a CSS rule like the one above that removes all the margins, padding and borders then all your form elements will have no border. IE your text fields and textareas etc will not have a clearly defined edge to them. By adding the line of CSS under this (select,input, etc) you can set the style width and colour of your form elements so that you control them, rather than the browser defaults. In Internet explorer this will also add borders to the checkbox and radio form elements. There does not seem to be any way of writing a CSS style to remove this inherently, so create a style of borderless and set all your radio and checkbox fields to &quot;class=borderless&quot;.

&lt;code&gt;
* {margin:0; padding:0; border: 0px;}

select,input,textarea{border-width: 1px; border-style: solid; border-color: grey;}

/* IE stops the radio borders */
.borderless{border: 0px;}
&lt;/code&gt;

&lt;h3&gt;Strange IE positioning fix&lt;/h3&gt;

Sometimes in IE (mainly 6) using position: absolute just does not render the div on screen. I am not sure why. Adding a &quot;clear: both;&quot; or a &quot;clear: left;&quot; or a &quot;clear: right;&quot; appears to fix this.

&lt;h3&gt;Easy centering of elements&lt;/h3&gt;

I used to struggle with centering elements on a page all the time, but now you can do something like this:

&lt;code&gt;
P.blockoftext {
    margin-left: auto;
    margin-right: auto;
    width: 6em
}

&lt;p class=&quot;blocktext&quot;&gt;Text&lt;/p&gt;

&lt;/code&gt;

This will center a block of text and give it a width of 6.

For images you can do this:

&lt;code&gt;

img.displayed {
    display: block;
    margin-left: auto;
    margin-right: auto }

&lt;img class=&quot;displayed&quot; src=&quot;...&quot; alt=&quot;...&quot;&gt;

&lt;/code&gt;

That will auto center the image inside its containing div.
				
				</description>
				
				
				<category>Internet Explorer</category>
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 18 Dec 2009 12:05:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/12/18/My-handy-IE-CSS-tweaks-list</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Firefox helpfully caching forms and their values</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/12/14/Firefox-helpfully-caching-forms-and-their-values</link>
				<description>
				
				Whilst building a form recently I hit a real noob stumbling block. I was trying to set a select value to selected if the value had previously been submitted, something like this:

&lt;code&gt;

&lt;cfset variables.prefix = &quot;Mr,Mrs,Ms,Miss,Dr&quot;&gt;
				&lt;select name=&quot;title&quot; size=&quot;1&quot; class=&quot;form-select&quot;&gt;
					&lt;option value=&quot;&quot;&gt;Please select from&lt;/option&gt;
					&lt;cfloop list=&quot;#variables.prefix#&quot; index=&quot;variables.index&quot; delimiters=&quot;,&quot;&gt;
						&lt;option value=&quot;#variables.index#&quot; &lt;cfif attributes.title EQ #variables.index#&gt; selected=&quot;yes&quot; &lt;/cfif&gt;&gt;#variables.index#&lt;/option&gt;
					&lt;/cfloop&gt;
				&lt;/select&gt;

&lt;/code&gt;

Pretty straight forward, you&apos;ll all agree. The issue comes in where I had entered selected=&quot;selected&quot;. This isn&apos;t the correct code for a select option. 

Handily Firefox will cache the form structure and form data, so that when you refresh the page it just loads up the cached version. This is great if you coded it correctly, otherwise it happily serves you up your coding errors again. So don&apos;t refresh your forms in testing. 

Add ?test=1 or something to make the request a new URL.
				
				</description>
				
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Mon, 14 Dec 2009 14:58:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/12/14/Firefox-helpfully-caching-forms-and-their-values</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Altering bullet point styling using css</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/11/13/Altering-bullet-point-styling-using-css</link>
				<description>
				
				I&apos;ve been writing an error handler that uses JQuery to output a list of errors on a validation event. The error display uses a html list display, and the default display style is a bullet list. This is a simple css script to change the bullet style to something else. In this case nothing!

&lt;code&gt;
&lt;style&gt;
      ul.list-cleaned {
        margin: 0;
        padding: 0;
      }
      ul.list-cleaned li {
        margin: 0;
        padding: 2px 0 2px 16px;
        list-style: none;}
&lt;/style&gt;

&lt;ul class=&quot;list-cleaned&quot;&gt;
	&lt;li&gt;First list item&lt;/li&gt;
	&lt;li&gt;Second list item&lt;/li&gt;
	&lt;li&gt;Third list item&lt;/li&gt;
&lt;/ul&gt;
&lt;/code&gt;

&lt;b&gt;Output:&lt;/b&gt;
&lt;style&gt;
      ul.list-cleaned {
        margin: 0;
        padding: 0;
      }
      ul.list-cleaned li {
        margin: 0;
        padding: 2px 0 2px 16px;
        list-style: none;}
&lt;/style&gt;

&lt;ul class=&quot;list-cleaned&quot;&gt;
	&lt;li&gt;First list item&lt;/li&gt;
	&lt;li&gt;Second list item&lt;/li&gt;
	&lt;li&gt;Third list item&lt;/li&gt;
&lt;/ul&gt;

I think it looks a bit cleaner than bullet points.
				
				</description>
				
				
				<category>CSS</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 13 Nov 2009 08:53:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/11/13/Altering-bullet-point-styling-using-css</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Changing a table row colour with JavaScript</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/9/3/Changing-a-table-row-colour-with-JavaScript</link>
				<description>
				
				I was recently looking at a way of people selecting many records from a data display. You know the usual table layout of data, populated with a query object. I decided on a column of checkboxes so that a user could select multiple records. The only issue with this was that it is not the most visible indicator of whether a record is selected.

So I thought I would add a JavaScript function to change the table row background colour, to show selected records.

Firstly here is a simple mock up of a table, populated with a list.

&lt;code&gt;
&lt;cfset variables.myList = &apos;1,2,3,4,5,6,7,8,9,10,11,12,13,14&apos;&gt;
&lt;cfparam name=&quot;variables.odd&quot; default=&quot;&quot;&gt;

&lt;cfoutput&gt;
&lt;table width=&quot;200&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;&gt;
&lt;cfloop list=&quot;#variables.myList#&quot; index=&quot;variables.row&quot;&gt;
	&lt;cfif (variables.row MOD 2) IS 1&gt;
		&lt;cfset variables.odd = true&gt;
	&lt;/cfif&gt;
	&lt;tr &lt;cfif variables.odd&gt; bgcolor=&quot;CCCCCC&quot; &lt;/cfif&gt; &gt;
		&lt;td&gt;Row #variables.row#&lt;/td&gt;
		&lt;td&gt;Data 2&lt;/td&gt;
		&lt;td align=&quot;middle&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;rowId&quot; name=&quot;rowId&quot; value=&quot;#variables.row#&quot; onclick=&quot;row_color(this,#variables.odd#)&quot;&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;cfset variables.odd = false&gt;
&lt;/cfloop&gt;
&lt;/table&gt;
&lt;/cfoutput&gt;

&lt;/code&gt;

The table rows are alternately coloured based on a basic odd/even check. This value is also passed to the function, as if we uncheck the record we want the row to return to its original colour.

Next we have the JavaScript function that each checkbox is running when it is clicked. The &apos;row_color&apos; function uses the &apos;this&apos; variable to work back up two elements using the &apos;parentNode&apos; function. This targets the table row (tr) tag, and changes its colour to whichever value is set at the top of the script. There are two colour off values as the table rows are alternately coloured, and we want them to return to their original colour when unselected.

&lt;code&gt;
&lt;scr/ipt type=&quot;text/javascript&quot;&gt;
	var color_on = &apos;#FFE7DF&apos;;
	var color_off_1 = &apos;#CCCCCC&apos;;
	var color_off_2 = &apos;#FFFFFF&apos;;
	
	function row_color(pTarget,row)
	{
		var pTR = pTarget.parentNode.parentNode;

		if(pTR.nodeName.toLowerCase() != &apos;tr&apos;)
		{
			return;
		}

		if(pTarget.checked == true)
		{
			pTR.style.backgroundColor = color_on;
		}
		else
		{
			if(row == 1)
			{
				pTR.style.backgroundColor = color_off_1;
			}
			else
			{
				pTR.style.backgroundColor = color_off_2;
			}
			
		}
	}
&lt;/scr/ipt&gt;
&lt;/code&gt;

&lt;img src=&quot;http://www.mccran.co.uk/images/tablepic.gif&quot; /&gt;
				
				</description>
				
				
				<category>Javascript</category>
				
				<category>HTML</category>
				
				<category>AJAX</category>
				
				<pubDate>Thu, 03 Sep 2009 09:52:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/9/3/Changing-a-table-row-colour-with-JavaScript</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Writing back to a multi select box using javascript</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/8/3/Writing-back-to-a-multi-select-box-using-javascript</link>
				<description>
				
				During the building of an online form I discovered that there was the need for a user to select multiple values from a select form field. This is done easily enough using multiple=&quot;true&quot;. What I then found was that I wanted them to be able to add more options to the select field, preferably without reloading the entire template. These options would then also be &apos;selected&apos; on being added to the select box. Below is a test script demonstrating this.

Initially I created a standard select form field, and populate it with a simulated query.

&lt;code&gt;
&lt;!--- Create a test query. ---&gt;
&lt;cfset variables.qOptions = QueryNew( &quot;id, name&quot; ) /&gt;

&lt;cfset QueryAddRow( variables.qOptions ) /&gt;
&lt;cfset variables.qOptions[ &quot;id&quot; ][ variables.qOptions.RecordCount ] = &quot;1&quot; /&gt;
&lt;cfset variables.qOptions[ &quot;name&quot; ][ variables.qOptions.RecordCount ] = &quot;Value 1&quot; /&gt;

&lt;cfset QueryAddRow( variables.qOptions ) /&gt;
&lt;cfset variables.qOptions[ &quot;id&quot; ][ variables.qOptions.RecordCount ] = &quot;2&quot; /&gt;
&lt;cfset variables.qOptions[ &quot;name&quot; ][ variables.qOptions.RecordCount ] = &quot;Value 2&quot; /&gt;

&lt;cfset QueryAddRow( variables.qOptions ) /&gt;
&lt;cfset variables.qOptions[ &quot;id&quot; ][ variables.qOptions.RecordCount ] = &quot;3&quot; /&gt;
&lt;cfset variables.qOptions[ &quot;name&quot; ][ variables.qOptions.RecordCount ] = &quot;Value 3&quot; /&gt;

&lt;cfset QueryAddRow( variables.qOptions ) /&gt;
&lt;cfset variables.qOptions[ &quot;id&quot; ][ variables.qOptions.RecordCount ] = &quot;4&quot; /&gt;
&lt;cfset variables.qOptions[ &quot;name&quot; ][ variables.qOptions.RecordCount ] = &quot;Value 4&quot; /&gt;
&lt;select name=&quot;item&quot; id=&quot;item&quot; class=&quot;input_text&quot; size=&quot;4&quot; multiple=&quot;true&quot;&gt;
&lt;cfloop query=&quot;variables.qOptions&quot;&gt;
		&lt;option value=&quot;#variables.qOptions.id#&quot;&gt;#variables.qOptions.name#&lt;/option&gt;
	&lt;/cfloop&gt;
&lt;/select&gt;

&lt;/code&gt;

Next we will add the form button that allows the user to add new values to the select field. The &apos;Add&apos; button invokes the javascript function AddItem().

&lt;code&gt;
&lt;input type=&quot;text&quot; name=&quot;newItem&quot; id=&quot;newItem&quot; size=&quot;30&quot;&gt; &lt;input type=&quot;button&quot; value=&quot;Add&quot; onclick=&quot;AddItem();&quot;&gt;
&lt;/code&gt;

So a user enters their new item into the text box, and it is inserted into the select field drop down, and automatically selected.

&lt;code&gt;

					function AddItem(){

						var newItemValue = document.getElementById(&quot;newItem&quot;).value;
						var list = document.getElementById(&apos;item&apos;);
						var startNewNum = document.getElementById(&apos;item&apos;).options.length;

						var newOption = new Option((newItemValue), newItemValue);

						// do it if there is a value
						if(newItemValue.length !== 0) {

							newOption.selected = true;
							list.options.add(newOption);

							newItem.value = &quot;&quot;;
							window.alert(&apos;You new value has been added&apos;);

						}
					}

&lt;/code&gt;

The javascript above gets the new item value, and inserts it as the last item in the select list. There is also a check to see if there is any text value in the form field. Just to round it off I remove the text field value, and alert the user.

There is probably a shinier way of doing this in something like JQuery, but I&apos;m not that up to speed on that. It would be interesting to see an example though. (hint!).
				
				</description>
				
				
				<category>Javascript</category>
				
				<category>HTML</category>
				
				<category>Web technologies</category>
				
				<pubDate>Mon, 03 Aug 2009 11:06:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/8/3/Writing-back-to-a-multi-select-box-using-javascript</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Displaying raw html onscreen using the Example html tag</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/7/30/Displaying-raw-html-onscreen-using-the-Example-html-tag</link>
				<description>
				
				Ever needed to display an example block of HTML code in a web based document or regular web page?

I had just that requirement recently, so thought I&apos;d have a dig around. It is one of the smallest html tags I&apos;ve found, it is the example tag.

&lt;code&gt;
&lt;xmp&gt; html code&lt;/xmp&gt;
&lt;/code&gt;

It works very much like the &apos;pre&apos; tag in the way that it displays whatever it contains without any sort of formatting, in its raw state. Except that this also display html, rather than interpreting it, it displays it exactly as is.

Nothing revolutionary, but a nice surprise and handy for code samples etc.
				
				</description>
				
				
				<category>General Interest</category>
				
				<category>HTML</category>
				
				<pubDate>Thu, 30 Jul 2009 14:32:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/7/30/Displaying-raw-html-onscreen-using-the-Example-html-tag</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Apostrophe ( &amp;amp;apos; ) display issues</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/7/1/Apostrophe--apos--display-issues</link>
				<description>
				
				It appears that the character entity &amp;amp;apos; is not a valid HTML entity. It was just XML, and thus XHTML. 

If you are using a browser that doesn&apos;t support XHTML then you probably shouldn&apos;t use it, as it will appear as a normal text string. I found this whilst testing something in IE 8, as that is not XHTML compliant.

So just use the &apos; character, or if you really feel that you have to escape it use:

&amp;amp;#39;

Just be careful with that one, as it will cause coldFusion to flip out. Then you may need to escape your escape characters, and then where will you be?
				
				</description>
				
				
				<category>Internet Explorer</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Wed, 01 Jul 2009 11:07:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/7/1/Apostrophe--apos--display-issues</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>IE 8 Https security warning pop up prompt annoyances</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/6/19/IE-8-Https-security-warning-pop-up-prompt-annoyances</link>
				<description>
				
				With the continue rollout of IE 8 some issues rise to the top of pile in the way the browser interacts with users. I can see &apos;why&apos; this next issue occurs, but it doesn&apos;t handle the user interaction very well at all.

One of the more significant changes is the way that IE handles security exceptions. The message to the user has been changed to be inversed. Usually a user will look for an &apos;ok&apos; button, but in this instance &apos;ok&apos; is the wrong answer (see screenshot).

&lt;img src=&quot;http://www.mccran.co.uk/images/images//securityWarning.jpg&quot; title=&quot;IE 8 Security Warning&quot;&gt;

This pop up happens when the site you are on is serving up non https content on an https URL, IE images and style links that are http://url/image.src rather than https://.

The only work around for this seems to be either having a user manually edit their IE settings, like this:

&lt;code&gt;
Tools &gt; internet options &gt; security &gt; custom level &gt; display mixed content: Enable
&lt;/code&gt;

&lt;img src=&quot;http://www.mccran.co.uk/images/images//ieSetting.jpg&quot;&gt;

This isn&apos;t exactly reasonable though. The other fix is to change all your content to be https. This is potentially a huge code change depending on how your site works.

I was hoping to find an IE 8 compatibility setting to revert this back to the same handling method as IE 7, but that doesn&apos;t seem to exist. If anyone has any ideas feel free to comment!
				
				</description>
				
				
				<category>Security</category>
				
				<category>Best practices</category>
				
				<category>HTML</category>
				
				<category>Web technologies</category>
				
				<pubDate>Fri, 19 Jun 2009 11:57:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/6/19/IE-8-Https-security-warning-pop-up-prompt-annoyances</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Gmail incorrectly displaying email content</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/5/28/Gmail-incorrectly-displaying-email-content</link>
				<description>
				
				I was recently working on an email application where users are sent emails on an automatic basis from the main web platform. There are many pitfalls to bulk email sending, and one of the oldest is how the email content will actually render in the users email client. Usually this is simply a case of people turning off images, or active scripting so they lose the majority of the design and layout.

Often people will include a &apos;Click here to view this online&apos; link at the top of the email as a substitute, as it&apos;s much easier to control the how the content of a web page displays than an email.

A new pitfall (for me!) is Gmail. I found that sending exactly the same content to a hotmail account and a Gmail account resulted in two different displays!

The email is a three column layout, with both of the side columns being coloured to provide a bordered edging. In Hotmail it displayed as designed and tested, but in Gmail the third column was gone, and the central column had lost its shape and was overlapping the right area!

I eventually tracked down the error to an extra set of ending tags:

&lt;code&gt;
&lt;/td&gt;
&lt;/tr&gt;	
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/code&gt;

I spent a few hours looking for them at this point, but couldn&apos;t find them anywhere. After backtracking and examining the rest of the email (it is made of several component blocks) I discovered that there was a small table layout error in the code. This was causing G mail to attempt to fix it itself! It was reading through the code and interpreting the error and trying to correct it. It was writing in the end tags above itself, so I was never going to find them in a template!

So one to note for the future, G mail is strict about the code it renders, and will happily rewrite anything it doesn&apos;t like.
				
				</description>
				
				
				<category>Best practices</category>
				
				<category>HTML</category>
				
				<category>Web technologies</category>
				
				<pubDate>Thu, 28 May 2009 15:58:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/5/28/Gmail-incorrectly-displaying-email-content</guid>
				
				
			</item>
			
		 	
			</channel></rss>