<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>ITauthor &#187; JavaScript</title>
	<atom:link href="http://www.itauthor.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itauthor.com</link>
	<description>Stuff about technical writing and software</description>
	<lastBuildDate>Sat, 07 Jan 2012 12:34:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<!-- podcast_generator="Blubrry PowerPress/2.0.4" -->
	<itunes:summary>Talking about technical writing, software and technology in general. The ITauthor Podcast is an advert-free, irregularly published show by technical writers for technical writers or anyone interested in software documentation or IT generally.</itunes:summary>
	<itunes:author>Alistair Christie - ITauthor.com</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.itauthor.com/images/ITauthor-PhotoLogo-300px.jpg" />
	<itunes:owner>
		<itunes:name>Alistair Christie - ITauthor.com</itunes:name>
		<itunes:email>comments@itauthor.com</itunes:email>
	</itunes:owner>
	<managingEditor>comments@itauthor.com (Alistair Christie - ITauthor.com)</managingEditor>
	<copyright>2006-2009</copyright>
	<itunes:subtitle>Talking about technical writing, software and technology in general.</itunes:subtitle>
	<itunes:keywords>itauthor, alistair christie, technology, writing, documentation</itunes:keywords>
	<image>
		<title>ITauthor &#187; JavaScript</title>
		<url>http://www.itauthor.com/images/ITauthor-PhotoLogo-144px.jpg</url>
		<link>http://www.itauthor.com/category/javascript/</link>
	</image>
	<itunes:category text="Technology">
		<itunes:category text="Software How-To" />
		<itunes:category text="Tech News" />
		<itunes:category text="Podcasting" />
	</itunes:category>
		<item>
		<title>Viewing dynamically generated HTML in the HTML Help viewer</title>
		<link>http://www.itauthor.com/2010/11/22/viewing-dynamically-generated-html-in-the-html-help-viewer/</link>
		<comments>http://www.itauthor.com/2010/11/22/viewing-dynamically-generated-html-in-the-html-help-viewer/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 20:49:00 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Online help]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/?p=1774</guid>
		<description><![CDATA[This is something I’ve blogged about twice before (in March 2004 and in January 2009), but going back to those topics just now neither of the solutions I gave at that time are working for me. So here’s the way to do it now. The problem The problem we’re trying to solve is how to [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I’ve blogged about twice before (<a href="http://www.itauthor.com/2004/03/02/viewing-dynamic-html-in-a-chm-topic/">in March 2004</a> and <a href="http://www.itauthor.com/2009/01/02/viewing-dynamically-generated-html-in-a-help-topic/">in January 2009</a>), but going back to those topics just now neither of the solutions I gave at that time are working for me. So here’s the way to do it now.</p>
<h3>The problem</h3>
<p>The problem we’re trying to solve is how to debug a topic in a CHM file where you’ve got JavaScript that dynamically changes the HTML at runtime (i.e. when the topic is displayed in the Microsoft HTML Help viewer). If you’re debugging issues in WebHelp output you have the fabulous <a href="http://getfirebug.com/downloads">Firebug</a> plugin that allows you (amongst other things) to click on objects in the output page and see what their HTML looks like right now. But unfortunately you can’t add Firebug to the help viewer. Or can you?</p>
<h3>Online solution</h3>
<p>This is the best solution, but it relies on you having:</p>
<ul>
<li>Internet access </li>
<li>JavaScript enabled (a safe assumption as it’s probably JavaScript you’re debugging here) </li>
<li>No firewall settings that might block code being downloaded from <strong>getfirebug.com</strong> (unlikely) </li>
</ul>
<p>If any of the above aren’t true then you’ll need to use the offline solution (<a href="#offline">below</a>).</p>
<p>The online solution uses the <a href="http://getfirebug.com/firebuglite#Stable">Firebug Lite bookmarklet</a> to add much of the functionality of the Firebug plugin for Firefox to the browser pane within the HTML Help Viewer. </p>
<ol>
<li>
<p>Do one of the following (these are just alternative ways of copying the same JavaScript to the clipboard):&#160; </p>
<p><strong><em>Either:</em></strong> Right-click this link – <a href="javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']&amp;&amp;F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createElement','setAttribute','getElementsByTagName','FirebugLite','4','firebug-lite.js','releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');">Firebug Lite</a> – and copy the link location (“Copy Shortcut” in IE).</p>
<p><strong><em>Or:</em></strong> Copy the following code:</p>
<p><code>javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']&amp;&amp;F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createElement','setAttribute','getElementsByTagName','FirebugLite','4','firebug-lite.js','releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');</code></p>
</li>
<li>Right-click the title bar of the HTML Help Viewer. </li>
<li>
<p>Choose <strong>Jump to URL</strong>.</p>
<p style="margin-top: -20pt; margin-bottom: -8pt"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jump-to-url" border="0" alt="jump-to-url" src="http://www.itauthor.com/wp-content/uploads/2010/11/jump-to-url.jpg" width="247" height="82" /></p>
</li>
<li>
<p>In the Jump to URL dialog box, paste the text you copied in step 1.</p>
<p style="margin-top: -20pt; margin-bottom: -8pt"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="JumpToURL" border="0" alt="JumpToURL" src="http://www.itauthor.com/wp-content/uploads/2010/11/JumpToURL.png" width="322" height="235" /></p>
</li>
<li>
<p>Click <strong>OK</strong>.</p>
<p>After a moment (while it downloads files) the Firebug panes are displayed across the bottom of the browser pane in the HTML Help viewer.</p>
</li>
<li>
<p>Click <strong>Inspect</strong>, then click an object in the topic pane.</p>
<p>The HTML for this object (including any dynamic modifications) is displayed in the HTML tab of the main Firebug pane:</p>
<p style="margin-top: -20pt; margin-bottom: -8pt"><a href="http://www.itauthor.com/wp-content/uploads/2010/11/Firebug-in-HelpViewer.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Firebug-in-HelpViewer" border="0" alt="Firebug-in-HelpViewer" src="http://www.itauthor.com/wp-content/uploads/2010/11/Firebug-in-HelpViewer_thumb.png" width="709" height="493" /></a></p>
</li>
</ol>
<p><strong><em></em></strong></p>
<p><strong><em>Note:</em></strong> External JavaScript and CSS files aren’t recognised because they reside at another domain. So, when you click the CSS tab all you’ll see it “There are no rules in this stylesheet” and in the Script tab you’ll get “Access to restricted URI denied”. However, the functionality of the HTML tab is enough to make this technique extremely valuable for debugging.</p>
<h3><a anchor="offline"></a>Offline solution</h3>
<p>The alternative is just to display the current, dynamically modified HTML in the browser pane. You can then select and copy/paste it into an editor for debugging.</p>
<p>To do this, copy and paste the following JavaScript into the Jump to URL dialog box:</p>
<p><code>javascript:'&lt;xmp&gt;'+window.document.documentElement.outerHTML+'&lt;/xmp&gt;';</code></p>
<p><strong><em>Note:</em></strong> The xmp element is deprecated and you shouldn't generally use it. However, in this case we know that we're using it in IE (the browser part of the HTML Help viewer) and IE, as of writing, still supports this element. If this stops being the case in future, the following is a less elegant (but standards-compliant) way of doing the same thing: </p>
<p><code>javascript:'&lt;pre&gt;'+window.document.documentElement.outerHTML.replace(/&lt;/g,'&amp;lt;')+'&lt;/pre&gt;';</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2010/11/22/viewing-dynamically-generated-html-in-the-html-help-viewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online JavaScript scratchpads</title>
		<link>http://www.itauthor.com/2010/11/20/online-javascript-scratchpads/</link>
		<comments>http://www.itauthor.com/2010/11/20/online-javascript-scratchpads/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 09:26:42 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/2010/11/20/online-javascript-scratchpads/</guid>
		<description><![CDATA[Writing JavaScript used to be a tricky and tedious business. Now, with Dojo, script.aculo.us and particularly jQuery it’s easy - and even fun - to write JavaScript. And if, like me, you’re an occasional JavaScript coder, and your skills are rusty every time you return to do something in JavaScript, another innovation you’ll find really [...]]]></description>
			<content:encoded><![CDATA[<p>Writing JavaScript used to be a tricky and tedious business. Now, with <a href="http://dojotoolkit.org/">Dojo</a>, <a href="http://script.aculo.us/">script.aculo.us</a> and particularly <a href="http://jquery.org/">jQuery</a> it’s easy - and even fun - to write JavaScript. And if, like me, you’re an occasional JavaScript coder, and your skills are rusty every time you return to do something in JavaScript, another innovation you’ll find really useful is the online scratchpad. These are Web sites where you can quickly try out some JavaScript. </p>
<p>The two I’ve been using recently are <a href="http://jsbin.com"><strong>jsbin</strong></a> and <a href="http://pastebin.me"><strong>pastebin</strong></a>.</p>
<p>For example:</p>
<ul>
<li><a title="http://jsbin.com/ejoye4/edit" href="http://jsbin.com/ejoye4/edit">http://jsbin.com/ejoye4/edit</a> – click <strong>Preview</strong> to see the output</li>
<li><a title="http://pastebin.me/6ddbefe3185f806d5903c7ab5664a673" href="http://pastebin.me/6ddbefe3185f806d5903c7ab5664a673">http://pastebin.me/6ddbefe3185f806d5903c7ab5664a673</a> – click <strong>EDIT CODE</strong> to see the code</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2010/11/20/online-javascript-scratchpads/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use the existence of a file on the server to determine Javascript behaviour in the browser</title>
		<link>http://www.itauthor.com/2010/11/19/use-jquery-to-check-whether-a-file-exists-on-the-server/</link>
		<comments>http://www.itauthor.com/2010/11/19/use-jquery-to-check-whether-a-file-exists-on-the-server/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 09:12:18 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[Flare]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/2010/11/19/use-jquery-to-check-whether-a-file-exists-on-the-server/</guid>
		<description><![CDATA[Rewritten post: Thanks to Janet Swisher for helping me avoid misleading folks with this. In this post I describe how (with the help of jQuery’s $.ajax() function) to use the existence of a file on the server as a switch to determine behaviour in the browser. Case study In my case, the problem I had [...]]]></description>
			<content:encoded><![CDATA[<p><em><font color="#808080">Rewritten post: Thanks to Janet Swisher for helping me avoid misleading folks with this.</font></em></p>
<p>In this post I describe how (with the help of jQuery’s <strong>$.ajax()</strong> function) to use the existence of a file on the server as a switch to determine behaviour in the browser. </p>
<h3>Case study</h3>
<p>In my case, the problem I had was that I use Madcap Flare to generate WebHelp output, and sometimes I want to build a customer version of the WebHelp and other times I want to build an internal version that has issue reporting functionality turned on. This adds little icons to the page that call some PHP for reporting, listing or searching for issues for the current page in the help system.</p>
<p>The issue reporting functionality is governed by a Javascript file, and I want to use a Flare condition to turn that functionality on or off. Flare can’t condition lines within a Javascript file to be included or not included in the output, but you <em>can</em> use Flare conditions to determine which files end up in the output. So I wanted a little bit of Javascript that said: if a particular file exists on the server turn on the issue reporting functionality, otherwise leave it turned off.</p>
<p>As with so many things Javascript, jQuery makes this easy. </p>
<link rel="stylesheet" type="text/css" href="/css/codemirror.css" />
<link rel="stylesheet" type="text/css" href="/css/codeframe.css" />
<h3><script type="text/javascript" src="/js/vendor/codemirror/basefiles.js"></script><script type="text/javascript" src="/js/vendor/codemirror/parsejavascript.js"></script>Code</h3>
<p style="margin-bottom: 0px">Here’s the jQuery code. Obviously you can replace the alert statements with something more useful.</p>
<p style="margin-top: -8pt; font-family: &#39;Courier New&#39;,courier,monospace; margin-bottom: 18pt"><span class="js-variable">     <br />$</span><span class="js-punctuation">.</span><span class="js-property">ajax</span><span class="js-punctuation">(</span><span class="js-punctuation">{</span>     <br /><span class="whitespace">&#160;&#160;&#160; </span><span class="js-property">url</span><span class="js-punctuation">:</span><span class="js-string">'/somedirectory/onyourserver/filetofind.html'</span><span class="js-punctuation">,</span>&#160; <br /><span class="whitespace">&#160;&#160;&#160; type</span><span class="js-punctuation">:</span><span class="js-string">'HEAD'</span><span class="js-punctuation">,</span>     <br /><span class="whitespace">&#160;&#160;&#160; </span><span class="js-property">error</span><span class="js-punctuation">:</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-keyword">function</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">{</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-variable">alert</span><span class="js-punctuation">(</span><span class="js-string">&quot;ERROR: File not found. \n:-(&quot;</span><span class="js-punctuation">)</span><span class="js-punctuation">;</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-punctuation">}</span><span class="js-punctuation">,</span>     <br /><span class="whitespace">&#160;&#160;&#160; </span><span class="js-property">success</span><span class="js-punctuation">:</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-keyword">function</span><span class="js-punctuation">(</span><span class="js-punctuation">)</span><span class="js-punctuation">{</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-variable">alert</span><span class="js-punctuation">(</span><span class="js-string">&quot;Nice one! File found. \n8-)&quot;</span><span class="js-punctuation">)</span><span class="js-punctuation">;</span>     <br /><span class="whitespace">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="js-punctuation">}</span>     <br /><span class="js-punctuation">}</span><span class="js-punctuation">)</span><span class="js-punctuation">;</span> </p>
<p><strong>Note</strong>: The file isn’t important. It’s purely being used as a switch. The file I use as the switch is actually the barest of bare-bones HTML files that is valid XHTML (which Flare demands). The <span style="font-family: &#39;Courier New&#39;,courier,monospace">type</span><span class="js-punctuation">:</span><span class="js-string">'HEAD'</span> statement in the code tells browsers just to request the HTTP response header for the file, not the contents of the file. However, as this is not supported on all browsers, you should only use this method if you know that the file being used as the switch is either empty of very small.</p>
<h3>Try it out</h3>
<p>To try this out, go to:    <br /><a title="http://jsbin.com/avalo4/2/edit" href="http://jsbin.com/avalo4/2/edit">http://jsbin.com/avalo4/2/edit</a></p>
<p>Click <strong>Preview</strong> to see the output. You should see the “File found” message.</p>
<p>Click <strong>Code</strong>, change the file name in the Javascript and click <strong>Preview</strong> again and this time (assuming the file doesn’t exist on the <strong>jsbin.com</strong> Web site) you’ll get the error message.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2010/11/19/use-jquery-to-check-whether-a-file-exists-on-the-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Overcoming hard-coded styles in Madcap Flare</title>
		<link>http://www.itauthor.com/2009/12/05/overcoming-hard-coded-styles-in-madcap-flare/</link>
		<comments>http://www.itauthor.com/2009/12/05/overcoming-hard-coded-styles-in-madcap-flare/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 20:56:27 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[Flare]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/2009/12/05/overcoming-hard-coded-styles-in-madcap-flare/</guid>
		<description><![CDATA[After several months away from Madcap Flare, coming back to work on it again, I’m reminded that one of the reasons I like this technical authoring tool is that it uses standard XHTML. So, if you’re using Flare to produce online help, you can modify your pages just like you could any Web page. So, [...]]]></description>
			<content:encoded><![CDATA[<p>After several months away from Madcap Flare, coming back to work on it again, I’m reminded that one of the reasons I like this technical authoring tool is that it uses standard XHTML. So, if you’re using Flare to produce online help, you can modify your pages just like you could any Web page. So, for example, because I don’t like Flare’s default (text-only) glossary popups, I’ve replaced those with my own variety that allow text formatting and images, and can be dragged around the screen. And because I don’t have the budget for Madcap’s Feedback Server, I’ve hooked our help system up to a MySQL database, using AJAX and PHP, to give some of the same functionality. All good stuff and it’s great to have the freedom to do that kind of customisation. </p>
<p>And with formatting and styling it’s pretty much the same story. By using CSS, you have a high degree of control over the look and feel of your output. For example, I’m working on a WebHelp system right now and it’s been fairly straightforward to get most of the output looking more or less how I want it to look. The simple things like changing the background colours, the fonts, the icons, and so on are easily done from within the Flare application. And there are other things you can achieve by using Javascript to inject a CSS file dynamically on page load, if you want to override things in the Flare stylesheets that are injected into your output files at build time.</p>
<p>However, I’m painfully reminded, working with Flare again today, that one of the reasons I’m not 100% of a Flare fan is that Madcap fell short of making the styling of output 100% configurable via stylesheets. </p>
<p>Things like the Related Topics popups rely on Javascript, triggered by an onClick event, to add elements to the topic. This is perfectly standard, but whoever coded this decided in their wisdom to embed style information directly into those HTML elements, rather than giving everything a class name and controlling the styles from a stylesheet. In the hierarchical system that is CSS, nothing gets to overrule styles applied directly within the style attribute of an element in the HTML, so if the coder coded: </p>
<p><code style="width: 185px; height: 13px">color=&quot;black&quot;</code></p>
<p>then you you can have any colour you want, <em>as long as it’s black</em> – that is, you don’t get to modify the colour in your stylesheet to something more subtle, you’re stuck with the coder’s idea of what looks best for your output.</p>
<p>So my particular example today was that I was trying to beautify the Related Topics popup a little. Here’s what it looks like out of the box:    <br /><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="related-topics1" border="0" alt="related-topics1" src="http://www.itauthor.com/wp-content/uploads/2009/12/relatedtopics1.png" width="382" height="119" /></p>
<p>And I managed to modify most of it. But I just couldn’t get at that close button. It’s added directly by the Javascript. If it was in a Madcap CSS file – for example, as the background image on a div – then I could have overridden it with my own close button. But in the end I thought: sod it, if I can’t replace it I’ll just remove it. So here’s what I ended up with: <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="related-topics2" border="0" alt="related-topics2" src="http://www.itauthor.com/wp-content/uploads/2009/12/relatedtopics2.png" width="556" height="118" /></p>
<p>I know I’m biased, but I think it’s a big improvement. A little close button would have been nice, but I think most users know, or will quickly work out, that clicking away from the popup box makes it go away.</p>
<p>To style this up I used the following Javascript to add an override CSS file, which allows me to get at some of those hard-to-read Madcap styles:</p>
<p><code style="width: 618px; height: 167px">$(document).ready(function(){      <br />&#160;&#160;&#160; ...       <br />&#160;&#160;&#160; //Append a link to the CSS file       <br />&#160;&#160;&#160; var newCSSlink=document.createElement('link');       <br />&#160;&#160;&#160; newCSSlink.setAttribute(&quot;href&quot;,&quot;Resources/StyleSheets/MCstylesOverrider.css&quot;);       <br />&#160;&#160;&#160; newCSSlink.setAttribute(&quot;rel&quot;,&quot;stylesheet&quot;);       <br />&#160;&#160;&#160; newCSSlink.setAttribute(&quot;type&quot;, &quot;text/css&quot;);       <br />&#160;&#160;&#160; headElement = document.getElementsByTagName(&quot;head&quot;)[0];       <br />&#160;&#160;&#160; headElement.appendChild(newCSSlink);       <br />&#160;&#160;&#160; ...       <br />});</code></p>
<p>This first line of the above code gives away that I’m using jQuery as an easy way to select and modify elements in the HTML. This just requires an extra Javascript file reference in the head of each page. If you use Javascript and you’re not familiar with jQuery, I’d strongly advise you have a look at it <em>now!</em></p>
<p>Within my <strong>MCstylesOverrider.css</strong> file, the bit of CSS that removes the div containing the close button is:</p>
<p><code style="width: 241px; height: 57px">div.MCKLinkBody div      <br />{       <br />&#160;&#160;&#160; display: none;       <br />}</code></p>
<p>Flare presents you with the old 80:20 rule. To get to a state where you’d be happy with the styling and behaviour of everything, you’d spend 20% of your time and effort getting 80% there, and then you’d spend the remaining 80% of the time finishing things off. For us pernickety perfectionists, Madcap could have made life a whole lot easier by making <em>everything</em> accessible and easy to change.</p>
<p>Message to software developers: when it comes to look and feel, less of the hard coding – please!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2009/12/05/overcoming-hard-coded-styles-in-madcap-flare/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google Gears</title>
		<link>http://www.itauthor.com/2007/06/13/google-gears/</link>
		<comments>http://www.itauthor.com/2007/06/13/google-gears/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 07:21:15 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[View all]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/2007/06/13/google-gears/</guid>
		<description><![CDATA[Google have introduced a new beta product called Gears that allows you to write Web-based applications for offline use. Quote: "Google Gears is an open source browser extension that lets developers create web applications that can run offline." This might be a handy way of creating little apps to do personal stuff. I'm going to [...]]]></description>
			<content:encoded><![CDATA[<p>Google have introduced a new beta product called Gears that allows you to write Web-based applications for offline use. Quote: "Google Gears is an open source browser extension that lets developers create web applications that can run offline."</p>
<p>This might be a handy way of creating little apps to do personal stuff. I'm going to have to go back and investigate the example applications when I've got some time:</p>
<p><a title="http://code.google.com/apis/gears/sample.html" href="http://code.google.com/apis/gears/sample.html">http://code.google.com/apis/gears/sample.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2007/06/13/google-gears/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>View generated source in Internet Explorer</title>
		<link>http://www.itauthor.com/2006/12/06/view-generated-source-in-internet-explorer/</link>
		<comments>http://www.itauthor.com/2006/12/06/view-generated-source-in-internet-explorer/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 14:47:52 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[View all]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/2006/12/06/view-generated-source-in-internet-explorer/</guid>
		<description><![CDATA[The Web Developer extension for Firefox is in invaluable when you are writing JavaScript that dynamically changes the HTML on a Web page. The feature I use most often is: right-click > Web Developer > View Source > View Generated Source This shows you the HTML as it is at this moment in time, rather [...]]]></description>
			<content:encoded><![CDATA[<p>The Web Developer extension for Firefox is in invaluable when you are writing JavaScript that dynamically changes the HTML on a Web page. The feature I use most often is:</p>
<p><em>right-click</em> > <strong>Web Developer</strong> > <strong>View Source</strong> > <strong>View Generated Source</strong></p>
<p>This shows you the HTML as it is at this moment in time, rather than the original HTML that came down the pipe.</p>
<p>Microsoft's <strong>Internet Explorer Developer Toolbar</strong> provides some useful functionality for the Web developer, but it doesn't have a <strong>View Generated Source</strong> option. However, I remembered an old posting (from March 2004) that had a way of viewing dynamically modified source for IE:</p>
<p><a href="http://www.itauthor.com/notes/archives/2004/03/viewing_dynamic.html">www.itauthor.com/notes/archives/2004/03/viewing_dynamic.html</a></p>
<p>The trick is to paste the following into the IE address bar:</p>
<p><textarea name="body" cols="60" rows="2" wrap="hard">javascript:void(window.open(&#34;javascript:document.open(\&#34;text/plain\&#34;);document.write(opener.document.body.parentNode.outerHTML)&#34;))</textarea></p>
<p>This opens a new window or tab and shows the generated source. I've been using it in IE7 and it's a God-send.</p>
<p>BTW: to get the <strong>Internet Explorer Developer Toolbar</strong>, visit:<br />
<a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=E59C3964-672D-4511-BB3E-2D5E1DB91038&#038;displayLang=en">www.microsoft.com/downloads/</a></p>
<p><span id="more-234"></span></p>
<p>If you're likely to find this useful, a handy tip is to create a shortcut. For example, from a Web page (not the JavaScript-generated page), drag the icon in the address bar to IE's Links toolbar. Right-click the new shortcut and choose <strong>Properties</strong>. In the Properties dialog box, change the name of the shortcut to "View Generated Source" and the URL to the JavaScript in the box above.</p>
<p>Now whenever you're browsing in IE, you can click this link to see the generated source.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/12/06/view-generated-source-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Test whether a page is in a frame</title>
		<link>http://www.itauthor.com/2006/11/28/test-whether-a-page-is-in-a-frame/</link>
		<comments>http://www.itauthor.com/2006/11/28/test-whether-a-page-is-in-a-frame/#comments</comments>
		<pubDate>Tue, 28 Nov 2006 16:37:27 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[View all]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/2006/11/28/test-whether-a-page-is-in-a-frame/</guid>
		<description><![CDATA[You can use the following JavaScript to test whether the current page is being displayed as a frame within a frameset, or is being displayed as a standard, standalone Web page. In this example I'm just displaying a message, in real life you could use this to change what's displayed on the page. For example, [...]]]></description>
			<content:encoded><![CDATA[<p>You can use the following JavaScript to test whether the current page is being displayed as a frame within a frameset, or is being displayed as a standard, standalone Web page.</p>
<p>In this example I'm just displaying a message, in real life you could use this to change what's displayed on the page. For example, I'm using similar code in a linked JavaScript file to show or hide a div on the page. I use this in a Flare Help project so that, when a topic is viewed as a standalone page a link is displayed allowing the user to view the page within the 3-frame Web Help (i.e. topic frame, navigation frame and toolbar frame).</p>
<p><code>
<pre>&lt;script language="javascript">
&lt;!--
function showHideHelpLink() {
   if (location.href == parent.location.href)  {
     alert("single page");
   }
   else {
     alert("I'm in a frame");
   }
}
// -->
&lt;/script></pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/11/28/test-whether-a-page-is-in-a-frame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting URL info</title>
		<link>http://www.itauthor.com/2006/02/28/getting-url-info/</link>
		<comments>http://www.itauthor.com/2006/02/28/getting-url-info/#comments</comments>
		<pubDate>Tue, 28 Feb 2006 09:30:57 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=186</guid>
		<description><![CDATA[= 4)) { window.external.AddFavorite(url, title); } else if (navigator.appName == 'Netscape') { window.sidebar.addPanel(title, url, ''); } else { alert('Press CTRL-D(Netscape) or CTRL-T(Opera) to Bookmark'); } } //--&#62; I have a set of complex web pages that are built in a frameset within a frameset (not my idea - this is WebHelp I've output from RoboHelp [...]]]></description>
			<content:encoded><![CDATA[<p>= 4)) {<br />
	window.external.AddFavorite(url, title);<br />
} else if (navigator.appName == 'Netscape') {<br />
	window.sidebar.addPanel(title, url, '');<br />
} else {<br />
	alert('Press CTRL-D(Netscape) or CTRL-T(Opera) to Bookmark');<br />
}<br />
}<br />
//--&gt;</p>
<p>I have a set of complex web pages that are built in a frameset within a frameset (not my idea - this is WebHelp I've output from RoboHelp and that's how it comes out). Fortunately, the JavaScript provided by RoboHelp includes a convenient way of calling a particular page within one of the embedded frames, using parameter values in the URL. For example, if the outermost page is called mainpage.html and the inner page you want to show is called mytopic.html then you can show this topic by calling up <strong>mainpage.html#mytopic.html</strong></p>
<p>This provides a way of bookmarking the current page within a complex frameset. But to do this we need 3 things:<br />
<br />1) The complete URL of the main page (which is the grandparent frame of the frame that contains the page you want to bookmark).<br />
<br />2) The file name of the page you want to bookmark.<br />
<br />3) The title of the page you want to bookmark.</p>
<p>The following button shows information about the page. On <i>this</i> page the values for the current page<br />
and the grandparent page are the same, because this page isn't in a frameset. You'll just have to take my word for it<br />
that this works when the current page is embedded in a frame of a frameset that is itself within a frameset.</p>
<form action="#">
</form>
<p>We can use the information shown in the alert box for the above button, to<br />
build the parameter values that we need to pass to the bookmark function. The following button displays the 'Add Bookmark' or 'Add Favorite' dialog box with the details for this page. Try clicking it - but if you use Firefox I'd recommend you don't actually add the bookmark, because the resulting bookmark will display a framed version of this page.</p>
<form action="#">
</form>
<p>Here's the bookmark function:</p>
<pre>
&lt;script language="javascript" type="text/javascript"&gt;
&lt;!--
function bookmark(url, title){
  if ((navigator.appName == 'Microsoft Internet Explorer') &amp;&amp; (parseInt(navigator.appVersion) &gt;= 4))
  {
    window.external.AddFavorite(url, title);
  }
  else if (navigator.appName == 'Netscape')
  {
    window.sidebar.addPanel(title, url, '');
  }
  else
  {
    alert('Press CTRL-D(Netscape) or CTRL-T(Opera) to Bookmark');
  }
}
//--&gt;
&lt;/script&gt;
</pre>
<p>View the source code to see the onclick values that call this function.</p>
<p><span id="more-186"></span></p>
<p>--------------------<br />
<br />I've just had another look at this. OK, so it's a pretty useless example because this page isn't framed. You just have to take my word for it that if this page was in a frame of a frameset within a frameset, clicking the second button would create a bookmark with a URL like: <strong>http://<i>domain/path</i>/mainpage.html#mytopic.html</strong></p>
<p>
A point to note is that this doesn't work if the file is hosted locally, rather than on a Web server. For this reason, you probably want to hide the button by default and then test the protocol value onload (see the first alert box), and display the button if the protocol is "http:".</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/02/28/getting-url-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>childNodes.length discrepancies in IE and Firefox</title>
		<link>http://www.itauthor.com/2006/02/11/childnodeslength-discrepancies-in-ie-and-firefox/</link>
		<comments>http://www.itauthor.com/2006/02/11/childnodeslength-discrepancies-in-ie-and-firefox/#comments</comments>
		<pubDate>Sat, 11 Feb 2006 08:16:15 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=182</guid>
		<description><![CDATA[I wrote a standard loadXML JavaScript function that goes off, opens an XML files, grabs the whole document and returns it. I put the contents of the document into a variable called root and then did: alert(root.childNodes.length); Here's my XML file: &#60;?xml version="1.0" ?&#62; &#60;relatedtopics&#62; &#60;topic id="createrolegroup" href="createrolegroup.html"&#62;Create a role group&#60;/topic&#62; &#60;topic id="usesettingseditor" href="usesettingseditor.html"&#62;Use the [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a standard loadXML JavaScript function that goes off, opens an XML files, grabs the whole document and returns it.</p>
<p>I put the contents of the document into a variable called <strong>root</strong> and then did:</p>
<p>
<pre>alert(root.childNodes.length);</pre>
</p>
<p>Here's my XML file:</p>
<pre>&lt;?xml version="1.0" ?&gt;

&lt;relatedtopics&gt;

	&lt;topic id="createrolegroup" href="createrolegroup.html"&gt;Create a role group&lt;/topic&gt;
	&lt;topic id="usesettingseditor" href="usesettingseditor.html"&gt;Use the Settings editor&lt;/topic&gt;
	&lt;topic id="turnonuserfriendlydatesinsearchqueries" href="turnonuserfriendlydatesinsearchqueries.html"&gt;Turn on user-friendly dates in search queries&lt;/topic&gt;
	&lt;topic id="systempicklistsindetail" href="systempicklistsindetail.html"&gt;The system picklists in detail&lt;/topic&gt;
	&lt;topic id="shutdownserver" href="shutdownserver.html"&gt;Shut down a server&lt;/topic&gt;

&lt;/relatedtopics&gt;</pre>
<p>What number do you think gets displayed by the alert?</p>
<p>The answer is different depending on which browser you use. In IE you get 5 (which is what I had expected), but in Firefox you get 11. Why?</p>
<p>The answer is that Firefox covertly adds a <strong>#text</strong> node for each area of whitespace between the child nodes that are visible in your XML. So in the above XML there's actually an invisible child node before the first topic element, another one between each topic element, and another after the last topic element - making 11 nodes in total.</p>
<p>If I'd written the XML like this:</p>
<pre>&lt;?xml version="1.0" ?&gt;

&lt;relatedtopics&gt;&lt;topic id="imadmin_createrolegroup" href="createrolegroup.html"&gt;Create a role group&lt;/topic&gt;&lt;topic id="imadmin_usesettingseditor" href="usesettingseditor.html"&gt;Use the Settings editor&lt;/topic&gt;&lt;topic id="imadmin_turnonuserfriendlydatesinsearchqueries" href="turnonuserfriendlydatesinsearchqueries.html"&gt;Turn on user-friendly dates in search queries&lt;/topic&gt;&lt;topic id="imadmin_systempicklistsindetail" href="systempicklistsindetail.html"&gt;The system picklists in detail&lt;/topic&gt;&lt;topic id="imadmin_shutdownserver" href="shutdownserver.html"&gt;Shut down a server&lt;/topic&gt;&lt;/relatedtopics&gt;</pre>
<p>I would have got 5 in both browsers.</p>
<p>This is nicely explained, with a useful diagram, in an article called "Whitespace in the DOM" at <a href="http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM">http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/02/11/childnodeslength-discrepancies-in-ie-and-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select a code sample &#8211; using JavaScript</title>
		<link>http://www.itauthor.com/2005/02/26/select-a-code-sample-using-javascript/</link>
		<comments>http://www.itauthor.com/2005/02/26/select-a-code-sample-using-javascript/#comments</comments>
		<pubDate>Sat, 26 Feb 2005 08:52:02 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=127</guid>
		<description><![CDATA[function turnon(td) { td.className='divmenuover'; } function turnoff(td) { td.className='divmenu'; } function copycode(ta) { var obj = document.forms[ta].code; if ( (navigator.appName=="Microsoft Internet Explorer") &#38;&#38; (parseInt(navigator.appVersion)&#62;=4) ) { copythecode(obj); } else { highlightthecode(obj); } } function highlightthecode(obj) { obj.select(); obj.focus(); } function copythecode(obj) { highlightthecode(obj); textRange = obj.createTextRange(); textRange.execCommand("RemoveFormat"); textRange.execCommand("Copy"); alert("Code segment has been copied to your [...]]]></description>
			<content:encoded><![CDATA[<p>       function turnon(td) {<br />
          td.className='divmenuover';<br />
       }<br />
       function turnoff(td) {<br />
          td.className='divmenu';<br />
       }</p>
<p>       function copycode(ta) {<br />
          var obj = document.forms[ta].code;<br />
          if ( (navigator.appName=="Microsoft Internet Explorer") &amp;&amp; (parseInt(navigator.appVersion)&gt;=4) ) {<br />
            copythecode(obj);<br />
          }<br />
          else {<br />
            highlightthecode(obj);<br />
          }<br />
       }</p>
<p>       function highlightthecode(obj) {<br />
          obj.select();<br />
          obj.focus();<br />
       } </p>
<p>       function copythecode(obj) {<br />
          highlightthecode(obj);<br />
          textRange = obj.createTextRange();<br />
          textRange.execCommand("RemoveFormat");<br />
          textRange.execCommand("Copy");<br />
          alert("Code segment has been copied to your clipboard.");<br />
       } </p>
<p>The following code (from <a href="http://www.searchengineforums.com/">www.searchengineforums.com</a>) allows you to click a link to select all the code in a textarea box. You can then Ctrl+C it to copy it. If you're using Internet Explorer, it's copied to the clipboard for you.</p>
<form name='code1'>
<a href='copycode("code1")'>Select the code</a></p>
<p><textarea name='code' cols='70' rows='9'></p>
<p>       function turnon(td) {<br />
          td.className='divmenuover';<br />
       }<br />
       function turnoff(td) {<br />
          td.className='divmenu';<br />
       }</p>
<p>       function copycode(ta) {<br />
          var obj = document.forms[ta].code;<br />
          if ( (navigator.appName=="Microsoft Internet Explorer") &amp;&amp; (parseInt(navigator.appVersion)&gt;=4) ) {<br />
            copythecode(obj);<br />
          }<br />
          else {<br />
            highlightthecode(obj);<br />
          }<br />
       }</p>
<p>       function highlightthecode(obj) {<br />
          obj.select();<br />
          obj.focus();<br />
       } </p>
<p>       function copythecode(obj) {<br />
          highlightthecode(obj);<br />
          textRange = obj.createTextRange();<br />
          textRange.execCommand("RemoveFormat");<br />
          textRange.execCommand("Copy");<br />
          alert("Code segment has been copied to your clipboard.");<br />
       } </p>
<p></textarea><br /> <br />
</form>
<p>As I mentioned above, this piece of Javascript comes from <a href="http://www.searchengineforums.com/">www.searchengineforums.com</a>. This site contains a stack of interesting forums and is well worth checking out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/26/select-a-code-sample-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Showing classes, IDs &amp; tag names in the status bar</title>
		<link>http://www.itauthor.com/2004/04/03/showing-classes-ids-tag-names-in-the-status-bar/</link>
		<comments>http://www.itauthor.com/2004/04/03/showing-classes-ids-tag-names-in-the-status-bar/#comments</comments>
		<pubDate>Sat, 03 Apr 2004 23:18:06 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=62</guid>
		<description><![CDATA[A useful tip for debugging a Web page. To display the CSS class name of objects on the page as you move the mouse over them, add the following JavaScript in the head section of the page (or in the link .js file): document.onmouseover=Function("window.status=event.srcElement.className"); The class name is displayed in the status bar. You can [...]]]></description>
			<content:encoded><![CDATA[<p>A useful tip for debugging a Web page.</p>
<p>To display the CSS class name of objects on the page as you move the mouse over them, add the following JavaScript in the head section of the page (or in the link <b>.js</b> file):</p>
<p><b>document.onmouseover=Function("window.status=event.srcElement.className");</b></p>
<p>The class name is displayed in the status bar.</p>
<p>You can do the same thing for element names (change <b>className</b> to <b>tagName</b>) or IDs (change <b>className </b>to <b>id</b>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/04/03/showing-classes-ids-tag-names-in-the-status-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Giving in to JavaScript</title>
		<link>http://www.itauthor.com/2003/12/02/giving-in-to-javascript/</link>
		<comments>http://www.itauthor.com/2003/12/02/giving-in-to-javascript/#comments</comments>
		<pubDate>Tue, 02 Dec 2003 14:44:34 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=29</guid>
		<description><![CDATA[How to use a few lines of JavaScript to detect which browser is being used and point the browser to an appropriate CSS file. This is the only way I know to get round the differences in the way Mozilla and IE render CSS.]]></description>
			<content:encoded><![CDATA[<p>After wasting too much time scouring the internet for a way of positioning things accurately in Firebird/Mozilla and IE using only CSS, I've given in and gone for using two separate CSS files, with the following lines of JavaScript to direct the browser to the appropriate file:</p>
<div>var browser;</p>
<p>if (navigator.appName.indexOf('Netscape') != -1) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;document.write('&lt;'+'link rel="stylesheet"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;href="css/FirebirdCompatible.css" /&gt;');<br />
}<br />
else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;document.write('&lt;'+'link rel="stylesheet"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;href="css/IEcompatible.css" /&gt;');<br />
}</div>
<p></p>
<p>OK, so I've given in. But at least now I can get on and finish off the page, which has been languishing, three-quarters-done, for about a week now. <a href="itauthor.com/index.html">ITauthor.com</a> will then, finally, have a proper home page.<br />
<span id="more-29"></span><br />
<br /><i>NOTE</i></p>
<p>In case you're wondering how I styled the code above (in other words, for my own benefit when I want to do the same thing in a few weeks time and can't remember what I did). I just typed in an inline style in the normal MovableType input box.</p>
<p>For more details about inline CSS, take a look at:<br />
<a href="http://www.alabamatechnologies.com/resources/css-09.asp">http://www.alabamatechnologies.com/resources/css-09.asp</a><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2003/12/02/giving-in-to-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

