<?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>The Thinking Lemur &#187; Javascript</title>
	<atom:link href="http://thinkinglemur.com/index.php/category/thinking/programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://thinkinglemur.com</link>
	<description>from the mind of Donnie Bachan</description>
	<lastBuildDate>Fri, 06 Jan 2012 10:42:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>IE 7/8 PNG-24 transparency issue</title>
		<link>http://thinkinglemur.com/index.php/2010/06/ie-78-png-24-transparency-issue/</link>
		<comments>http://thinkinglemur.com/index.php/2010/06/ie-78-png-24-transparency-issue/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 11:12:47 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=384</guid>
		<description><![CDATA[We came across an error today with our drop down menu system that uses a PNG-24 semi transparent drop shadow image around the border where the transparency would appear black in IE 7 and IE 8. After searching and trying all possible fixes we found the solution to the problem and it was quite simple. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2010%2F06%2Fie-78-png-24-transparency-issue%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2010%2F06%2Fie-78-png-24-transparency-issue%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>We came across an error today with our drop down menu system that uses a PNG-24 semi transparent drop shadow image around the border where the transparency would appear black in IE 7 and IE 8. After searching and trying all possible fixes we found the solution to the problem and it was quite simple.</p>
<p>Our menu system uses jQuery (doesn't everything these days?), and had a nice fade in and fade out transition. jQuery handles the fade transitions by setting the opacity which IE does not like very much. So using the fadeTo() functions in jQuery is a no-no in IE. The solution, use hide() and show() instead. It's not as elegant but the transparency issue was fixed on all modern browsers.</p>
<p>Other solutions to the problem include:</p>
<p>1. Using a background colour instead of transparent on the style so you would do:</p>
<blockquote><p>.my-transparent-stuff{background: #fff url('image.png') repeat-y scroll left top;}</p>
<p>instead of</p>
<p>.my-transparent-stuff{background: transparent url('image.png') repeat-y scroll left top;}</p></blockquote>
<p>2. Using PNG-8/transparent gifs (hey, it's a solution)</p>
<p>3. Forcing IE8 into IE7 mode by adding the following meta tag:</p>
<blockquote><p>&lt;meta http-equiv="X-UA-Compatible" content="IE=7" /&gt;</p></blockquote>
<p>I still can't understand what Microsoft is doing!</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2010/06/ie-78-png-24-transparency-issue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The fear of Javascript Frameworks</title>
		<link>http://thinkinglemur.com/index.php/2009/02/the-fear-of-javascript-frameworks/</link>
		<comments>http://thinkinglemur.com/index.php/2009/02/the-fear-of-javascript-frameworks/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 11:21:04 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=72</guid>
		<description><![CDATA[I have always been one of those developers who like to "write my own stuff" because nothing produced by another person could ever be as good as mine! I'm sure the majority of developers out there feel the same way. But as they say with experience comes wisdom and I have come to realise that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2009%2F02%2Fthe-fear-of-javascript-frameworks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2009%2F02%2Fthe-fear-of-javascript-frameworks%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I have always been one of those developers who like to "write my own stuff" because nothing produced by another person could ever be as good as mine! I'm sure the majority of developers out there feel the same way. But as they say with experience comes wisdom and I have come to realise that maybe the solution you are trying to solve has been solved by someone else and the cost of implementing your own solution is far greater than the cost of implementing something that has already been developed and in most cases battle tested. Now there are exceptions to this but I think that, and this is especially true for Javascript frameworks, you are better off using what's been built before and which has a proven track record.</p>
<p>I believe that using a Javascript framework is quite important in the current web development environment. These frameworks provide rich functions that allow developers to quickly and efficiently accomplish tasks that are quite difficult and/or tedious without them. The first time I looked at the source code for the Prototype JS library (<a href="http://prototypejs.org">http://prototypejs.org</a>) I fell in love. Sam Stephenson is a god and has produced the most beautiful javascript code ever! I know that what he has done in the framework simply brings together a lot of pieces that have been scattered about the development community, but that library is simply AWESOME. There are a lot of people out there who will say it is too fat and overkill for most things which is the reason frameworks such as jQuery (<a href="http://jQuery.com">http://jQuery.com</a>), mooTools (<a href="http://mootools.net">http://mootools.net</a>), dojo (<a href="http://dojotoolkit.org">http://dojotoolkit.org</a>), Ext (<a href="http://extjs.com">http://extjs.com</a>) and Adobe's Spry Framework (<a href="http://labs.adobe.com/technologies/spry/">http://labs.adobe.com/technologies/spry/</a>) have appeared. </p>
<p>I personally use Prototype and jQuery in most projects, I love both of them. Prototype has, in my opinion much more flexibility but jQuery is really excellent as well and has many, many super features. I think all developers should seriously lookat these frameworks if you haven't yet, even if it's just to look at the source code and learn some excellent tricks!</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2009/02/the-fear-of-javascript-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdFusion 8 CFWindow caching problem</title>
		<link>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-cfwindow-caching-problem/</link>
		<comments>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-cfwindow-caching-problem/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 06:16:29 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[CFWindow]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=28</guid>
		<description><![CDATA[This iteration of ColdFusion is absolutely wonderful. Now anyone can AJAX and look like a DHTML guru with just a few lines of code. A previous post outlined the problem of not being able to refresh the CFWindow content. CF8 uses the EXT js library as of version 1.1.1 (I think) which by default does [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F11%2Fcoldfusion-8-cfwindow-caching-problem%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F11%2Fcoldfusion-8-cfwindow-caching-problem%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This iteration of ColdFusion is absolutely wonderful. Now anyone can AJAX and look like a DHTML guru with just a few lines of code. A <a href="http://thinkinglemur.com/index.php/2007/09/refreshing-a-cfwindow/">previous post</a> outlined the problem of not being able to refresh the CFWindow content. CF8 uses the EXT js library as of version 1.1.1 (I think) which by default does not provide a way to refresh the content of an element without actually manipulating the body property of the BasicDialog object. In CF the problem is even more complicated because you cannot just destroy a window and recreate it. There is no means to directly do this, so you have to access the underlying Ext library and call the destroy() function on the dialog. However, if you try to create a new window with the same name you get a javascript error. This is because the object is cached in the ColdFusion.objectCache object. Now, this is a good thing but the problem is that you cannot destroy the window easily. I would think this is a common task and should have been added. To work around the problem, you have to remove the element from the cache...</p>
<blockquote><p>// get a reference to the Ext object<br />
var mywin = Coldfusion.Window.getWindowObject('my-window-1');</p>
<p>// destroy the window and remove the elements from the DOM<br />
mywin.destroy(true);</p>
<p>// remove the element from the ColdFusion.objectCache<br />
ColdFusion.objectCache['my-window-1'] = null;</p></blockquote>
<p>This would allow you to recreate the window via script without any problems. I think this is a serious oversight and a function should be added to allow for this operation.</p>
<p>The ColdFusion.objectCache is a very handy tool and should have better documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-cfwindow-caching-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ColdFusion 8 HTML CFGrid href attribute with JavaScript function</title>
		<link>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-html-cfgrid-href-attribute-with-javascript-function/</link>
		<comments>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-html-cfgrid-href-attribute-with-javascript-function/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 09:53:59 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CFGrid]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=25</guid>
		<description><![CDATA[I was going crazy trying to figure out why my href in the cfgridcolumn tag was not working with the new CFGrid in html mode. Apparently the appendKey attribute of the CFGrid tag is set to TRUE by default and this forces the href attribute to be a valid url. If you change the appendKey [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F11%2Fcoldfusion-8-html-cfgrid-href-attribute-with-javascript-function%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F11%2Fcoldfusion-8-html-cfgrid-href-attribute-with-javascript-function%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I was going crazy trying to figure out why my href in the cfgridcolumn tag was not working with the new CFGrid in html mode. Apparently the appendKey attribute of the CFGrid tag is set to TRUE by default and this forces the href attribute to be a valid url. If you change the appendKey to FALSE, javascript functions work in the cfgridcolumn tags just fine....</p>
<p>So:</p>
<blockquote><p>&lt;code&gt;<br />
&lt;cfform&gt;<br />
&lt;cfgrid format="html" name="gContentLibrary" pagesize="#request.maxrows#"<br />
bind="url:..."<br />
&gt;<br />
&lt;cfgridcolumn name="title" href="javascript:makeRequest('viewlibraryitem',{gridid:'gContentLibrary'})" display="true" header="Object Title" width="250" /&gt;<br />
&lt;/cfgrid&gt;<br />
&lt;/cfform&gt;<br />
&lt;/code&gt;<br />
will not work but<br />
&lt;code&gt;<br />
&lt;cfform&gt;<br />
&lt;cfgrid format="html" name="gContentLibrary" pagesize="#request.maxrows#"<br />
bind="url:..."<br />
appendKey = "no"<br />
&gt;<br />
&lt;cfgridcolumn name="title" href="javascript:makeRequest('viewlibraryitem',{gridid:'gContentLibrary'})" display="true" header="Object Title" width="250" /&gt;<br />
&lt;/cfgrid&gt;<br />
&lt;/cfform&gt;<br />
&lt;/code&gt;</p></blockquote>
<p>will work.</p>
<p>I may be stupid but it took a long time for me to figure this out and I didn't even find a reference to this on Google....either, people aren't doing this or everyone is much smarter than I am! Anyway I hope it helps someone out there...</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2007/11/coldfusion-8-html-cfgrid-href-attribute-with-javascript-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Refreshing a CFWindow</title>
		<link>http://thinkinglemur.com/index.php/2007/09/refreshing-a-cfwindow/</link>
		<comments>http://thinkinglemur.com/index.php/2007/09/refreshing-a-cfwindow/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 07:29:59 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CFWindow]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=22</guid>
		<description><![CDATA[Recently I came across the situation where I wanted to refresh a cfwindow with a source tag that was bound to a hidden form field. When the value of the form field changed I wanted the window information to be reloaded, however since the value was being changed via javascript the onChange event was not [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F09%2Frefreshing-a-cfwindow%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F09%2Frefreshing-a-cfwindow%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently I came across the situation where I wanted to refresh a cfwindow with a source tag that was bound to a hidden form field. When the value of the form field changed I wanted the window information to be reloaded, however since the value was being changed via javascript the onChange event was not being fired on the hidden field and so the cfwindow was not refreshing. I then decided to take another approach. I would use the ColdFusion.Window.create function and create a new window each time it is needed. In order to not have multiple instances of the window I would destroy the old window before creating the new one.</p>
<blockquote><p>&lt;code&gt;<br />
function getPageId()<br />
{<br />
return pageid;<br />
}</p>
<p>function createWindow(name)<br />
{</p>
<p>try<br />
{<br />
twin = ColdFusion.Window.getWindowObject(name);<br />
twin.destroy(true);<br />
}<br />
catch (e)<br />
{<br />
// do nothing because the window does not exist<br />
}<br />
ColdFusion.Window.create(win, 'Edit Page Properties',<br />
'test.cfm?id='+getPageId(),<br />
{height:750,width:960,modal:true,closable:false,<br />
draggable:false,resizable:true,center:true,initshow:true})</p>
<p>}<br />
&lt;/code&gt;</p></blockquote>
<p>If I pass the same window name each time the window never refreshes! Even though pageid is changing. This seems to be because the window object is cached somehow. When I set the destroy(true) parameter another error comes up since the element is removed completely from the DOM. To work around this, each window created MUST have a unique name. If the name is not unique errors will occur since it seems that CF caches the name used for a window. I am not sure where and am in no mood to look for it at this point. Here is the code that works.</p>
<blockquote><p>&lt;code&gt;<br />
var winname = '';</p>
<p>function getPageId()<br />
{<br />
return pageid;<br />
}</p>
<p>function createWindow(name)<br />
{<br />
win = name + "_os_" + Math.round(Math.random() * 10000000000);<br />
try<br />
{<br />
twin = ColdFusion.Window.getWindowObject(winname);<br />
twin.destroy(true);<br />
}<br />
catch (e)<br />
{<br />
// do nothing because the window does not exist<br />
}<br />
ColdFusion.Window.create(win, 'Edit Page Properties',<br />
'test.cfm?pageid='+getPageId(),<br />
{height:750,width:960,modal:true,closable:false,<br />
draggable:false,resizable:true,center:true,initshow:true})<br />
winname = win;<br />
}<br />
&lt;/code&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2007/09/refreshing-a-cfwindow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stupid IE&#8230;Again!</title>
		<link>http://thinkinglemur.com/index.php/2007/04/stupid-ieagain/</link>
		<comments>http://thinkinglemur.com/index.php/2007/04/stupid-ieagain/#comments</comments>
		<pubDate>Mon, 09 Apr 2007 09:59:39 +0000</pubDate>
		<dc:creator>Donnie Bachan</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://thinkinglemur.com/?p=30</guid>
		<description><![CDATA[I am hopeful that there will come a time when Microsoft's IE team will learn that developers really need error messages that make some sense! I am working on this application that uses the Yahoo! UI library and in particular the menu widget. It works fine on Firefox and on IE on my local network [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F04%2Fstupid-ieagain%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthinkinglemur.com%2Findex.php%2F2007%2F04%2Fstupid-ieagain%2F&amp;source=thinkinglemur&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I am hopeful that there will come a time when Microsoft's IE team will learn that developers really need error messages that make some sense! I am working on this application that uses the Yahoo! UI library and in particular the menu widget. It works fine on Firefox and on IE on my local network but anything outside my network gives the following error:</p>
<blockquote><p>Internet Explorer cannot open the internet site xxxxxxx. Operation Aborted</p></blockquote>
<p>The reason for the error is that the DOM hasn't fully loaded before the Javascript on the page tried to manipulate it. It is solved by easily adding the required initilisation functions queued by the YUI library's event manager.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkinglemur.com/index.php/2007/04/stupid-ieagain/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

