<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.com/cs/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">David Cilley's AJAX Imaging Blog</title><subtitle type="html">Thoughts on ASP.NET, AJAX, cross-browser JavaScript, and other thin client technologies.</subtitle><id>http://www.atalasoft.com/cs/blogs/davidcilley/atom.aspx</id><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/default.aspx" /><link rel="self" type="application/atom+xml" href="http://www.atalasoft.com/cs/blogs/davidcilley/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2007-05-02T14:50:00Z</updated><entry><title>UpdatePanel and Sys.Application.add_load Woes</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx</id><published>2009-06-25T23:34:00Z</published><updated>2009-06-25T23:34:00Z</updated><content type="html">&lt;P&gt;I’ve found (&lt;A href="http://forums.asp.net/p/1281757/2459028.aspx#2459028" target=_blank&gt;as others have&lt;/A&gt;) an interesting problem with ASP.NET AJAX’s Sys.Application.add_load function.&amp;nbsp; It doesn’t quite work as expected in all browser environments, under certain conditions.&lt;/P&gt;
&lt;P&gt;We have several ASP.NET based controls that use a lot of JavaScript on page load to initialize, and most of these controls are supposed to support being nested inside of an UpdatePanel.&amp;nbsp; For whatever reason, our composite controls’ initialization JavaScript manages to render after the call to Sys.Application.initialize.&amp;nbsp; Since our file based scripts load inside of the UpdatePanel, they are required to make calls to Sys.Application.notifyScriptLoaded as they load.&lt;/P&gt;
&lt;P&gt;In Firefox 3, Safari 3 (on Windows), and Opera 9, the initialization scripts never run on the first load.&amp;nbsp; From my tests, I’ve concluded that Internet Explorer, Chrome, and FireFox 2 don’t have this problem.&lt;/P&gt;
&lt;P&gt;Here are the basic conditions that cause this:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Your script block renders after the Sys.Application.initialize block that ASP.NET injected into the page. &lt;/LI&gt;
&lt;LI&gt;You add your initialization script to the load event by using Sys.Application.add_load. &lt;/LI&gt;
&lt;LI&gt;You have at least one file based script file that calls Sys.Application.notifyScriptLoaded to notify the application that you’re waiting for scripts to load before you run your initialization script. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The solution that I’ve seen provided for edge cases such as this, states that you can define your initialization function anywhere on the page as shown:&lt;/P&gt;&lt;PRE style="BORDER-BOTTOM:#800000 1px solid;BORDER-LEFT:#800000 1px solid;PADDING-BOTTOM:5px;BACKGROUND-COLOR:#fbfbfb;MIN-HEIGHT:40px;PADDING-LEFT:5px;WIDTH:650px;PADDING-RIGHT:5px;OVERFLOW:auto;BORDER-TOP:#800000 1px solid;BORDER-RIGHT:#800000 1px solid;PADDING-TOP:5px;"&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; pageLoad(){
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// initialize your JavaScript here&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}&lt;/PRE&gt;&lt;/PRE&gt;
&lt;P&gt;From what I can tell, this works great for almost everyone that encounters this problem.&amp;nbsp; The documentation for this reserved named function is located in the &lt;A href="http://www.asp.net/ajax/documentation/live/overview/AJAXClientEvents.aspx" target=_blank&gt;ASP.NET AJAX Client Life-Cycle Events&lt;/A&gt; section.&lt;/P&gt;
&lt;P&gt;This won’t help us unfortunately, since our controls are being used by developers that may need to use the same method.&amp;nbsp; Defining a pageLoad function on the page where someone else has already defined it will basically nullify the other function of that name.&amp;nbsp; So where does that leave us?&amp;nbsp; The DOM.&lt;/P&gt;
&lt;P&gt;You may be thinking that I mean window.onload, and that’s sort of correct.&amp;nbsp; This event fires when the page is finished loading, but it only fires once, and doesn’t fire for every partial postback that the UpdatePanel does.&amp;nbsp; By using Sys.UI.DomEvent.addHandler, we can add an event handler that behaves the same way as Sys.Application.add_load.&amp;nbsp; Here’s the code:&lt;/P&gt;&lt;PRE style="BORDER-BOTTOM:#800000 1px solid;BORDER-LEFT:#800000 1px solid;PADDING-BOTTOM:5px;BACKGROUND-COLOR:#fbfbfb;MIN-HEIGHT:40px;PADDING-LEFT:5px;WIDTH:650px;PADDING-RIGHT:5px;OVERFLOW:auto;BORDER-TOP:#800000 1px solid;BORDER-RIGHT:#800000 1px solid;PADDING-TOP:5px;"&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; yourInit(){
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// initialize your JavaScript here&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;if&lt;/SPAN&gt; (&lt;SPAN style="COLOR:#0000ff;"&gt;typeof&lt;/SPAN&gt;(Sys) !== 'undefined'){
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   Sys.UI.DomEvent.addHandler(&lt;SPAN style="COLOR:#0000ff;"&gt;window&lt;/SPAN&gt;, "&lt;SPAN style="COLOR:#8b0000;"&gt;load&lt;/SPAN&gt;", yourInit);
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;else&lt;/SPAN&gt;{
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// no ASP.NET AJAX, use your favorite event&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// attachment method here&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;/PRE&gt;
&lt;P&gt;In my tests, this made the initialize event fire in the correct manner for all of the browsers that I tested.&lt;/P&gt;
&lt;P&gt;If you have experience with this problem, and you found another way around it… please feel free to comment below.&amp;nbsp; Thanks!&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;;subject=UpdatePanel+and+Sys.Application.add_load+Woes" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;;title=UpdatePanel+and+Sys.Application.add_load+Woes" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;title=UpdatePanel+and+Sys.Application.add_load+Woes" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;;title=UpdatePanel+and+Sys.Application.add_load+Woes" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx&amp;amp;;title=UpdatePanel+and+Sys.Application.add_load+Woes&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=18721" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="ASP.NET" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="UpdatePanel" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/UpdatePanel/default.aspx" /></entry><entry><title>Internet Explorer TextArea scrollHeight Bug</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx</id><published>2009-06-23T22:04:00Z</published><updated>2009-06-23T22:04:00Z</updated><content type="html">&lt;P&gt;While working with some dynamically created textarea tags, I noticed some odd behavior in Internet Explorer.&amp;nbsp; I was trying to get a textarea tag to fit to the height of its content, while allowing a horizontal scrollbar for when a word (or url) is too long for the available width.&lt;/P&gt;
&lt;P&gt;Here is the function I came up with:&lt;/P&gt;&lt;PRE style="BORDER-BOTTOM:#800000 1px solid;BORDER-LEFT:#800000 1px solid;PADDING-BOTTOM:5px;BACKGROUND-COLOR:#fbfbfb;MIN-HEIGHT:40px;PADDING-LEFT:5px;WIDTH:650px;PADDING-RIGHT:5px;OVERFLOW:auto;BORDER-TOP:#800000 1px solid;BORDER-RIGHT:#800000 1px solid;PADDING-TOP:5px;"&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; fitTextToHeight(textarea){
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// get rid of scrollbars to get accurate height&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflow = 'hidden';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// set height to available scroll height&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.height = textarea.scrollHeight + 'px';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// allow horizontal scrolling if words are too long&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflowX = 'auto';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// keep the vertical scrollbar hidden, as it's no longer needed&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflowY = 'hidden';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;/PRE&gt;
&lt;P&gt;This function works great for all browsers that I tested (Firefox, Chrome, Safari, Opera) except Internet Explorer.&amp;nbsp; I tested it a bit further, to see how far back this bug goes, and I was able to reproduce it in IE6 through IE8 (At the time of this article v8.0.6001.18702).&amp;nbsp; IE 5.5 behaved as the other browsers did.&lt;/P&gt;
&lt;P&gt;To work around this issue, I noticed that just making a dummy statement for scrollHeight, makes it behave as expected.&amp;nbsp; Work around shown below:&lt;/P&gt;&lt;PRE style="BORDER-BOTTOM:#800000 1px solid;BORDER-LEFT:#800000 1px solid;PADDING-BOTTOM:5px;BACKGROUND-COLOR:#fbfbfb;MIN-HEIGHT:40px;PADDING-LEFT:5px;WIDTH:650px;PADDING-RIGHT:5px;OVERFLOW:auto;BORDER-TOP:#800000 1px solid;BORDER-RIGHT:#800000 1px solid;PADDING-TOP:5px;"&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; fitTextToHeight(textarea){
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// get rid of scrollbars to get accurate height&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflow = 'hidden';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// Internet Explorer 6-8 needs this to get the correct value&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.scrollHeight;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// set height to available scroll height&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.height = textarea.scrollHeight + 'px';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// allow horizontal scrolling if words are too long&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflowX = 'auto';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   &lt;SPAN style="COLOR:#008000;"&gt;// keep the vertical scrollbar hidden, as it's no longer needed&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;   textarea.style.overflowY = 'hidden';
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;}
&lt;/PRE&gt;&lt;PRE style="BACKGROUND-COLOR:#fbfbfb;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;FONT-SIZE:12px;"&gt;&lt;/PRE&gt;&lt;/PRE&gt;
&lt;P&gt;Here’s a demo: &lt;A href="http://www.atalasoft.com/cs/blogs/davidcilley/files/IETextAreaBug.html" target=_blank&gt;Internet Explorer TextArea scrollHeight Bug Demo&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;One other thing that I noticed, is that you can put an alert right before using the scrollHeight property, and it works fine.&amp;nbsp; So this is not necessarily just tied to accessing the scrollHeight property, it may have something to do with execution time.&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;;subject=Internet+Explorer+TextArea+scrollHeight+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;;title=Internet+Explorer+TextArea+scrollHeight+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;title=Internet+Explorer+TextArea+scrollHeight+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;;title=Internet+Explorer+TextArea+scrollHeight+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx&amp;amp;;title=Internet+Explorer+TextArea+scrollHeight+Bug&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=18707" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="Internet Explorer" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Internet+Explorer/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /></entry><entry><title>Internet Explorer 8 IFrame Height Nesting Bug</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx</id><published>2009-01-28T17:42:00Z</published><updated>2009-01-28T17:42:00Z</updated><content type="html">&lt;P&gt;While testing our components and demos in the latest Internet Explorer 8 release (RC1), I found that a particular combination of nesting percentage based elements, caused an IFrame that we use to size to the default height, rather than filling the parent element.&lt;/P&gt;
&lt;P&gt;The problem seems to only manifest when a div tag that uses both absolute based width (ex: 170px), and percentage based height (ex: 100%), is nested inside a table with absolute width and height.&lt;/P&gt;
&lt;P&gt;Here’s the xhtml that breaks it (the tag in bold is causing the height problem):&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;html&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;xmlns&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"http://www.w3.org/1999/xhtml"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;    &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;IE 8 IFrame Height Nesting Bug Demo&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;  &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;border&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellpadding&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellspacing&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:170px; height:494px;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;HEIGHT:19px;BACKGROUND-COLOR:#ffffff;"&gt;  &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:170px; height:494px;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;STRONG&gt;      &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;id&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"container_div"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:170px; height:100%;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;        &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellspacing&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellpadding&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;border&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;        &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%; background-color:Green;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;            &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;iframe&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;frameborder&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;marginwidth&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;marginheight&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%;"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;src&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"spacer.gif"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;iframe&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;            &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;        &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;        &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;   &lt;STRONG&gt;   &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;  &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;  &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;To work around the problem in this case, I was able to simply set the width to 100%:&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;   &lt;STRONG&gt;   &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;id&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"container_div2"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;         &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellspacing&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;cellpadding&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;border&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;         &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%; background-color:Green;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;             &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;iframe&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;frameborder&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;marginwidth&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;marginheight&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"width:100%; height:100%;"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;src&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"resources/mask.png"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;iframe&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;             &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;td&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;         &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;tr&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;         &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;  &lt;STRONG&gt;    &lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Here is a side by side comparison of the two snippets: &lt;A href="http://www.atalasoft.com/cs/blogs/davidcilley/files/IE8IFrameHeight.html" target=_blank&gt;IE 8 IFrame Height Nesting Bug Demo&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In case you don’t have IE8 installed, here is a screenshot: &lt;BR&gt;&lt;A href="http://www.atalasoft.com/cs/blogs/davidcilley/IE8IFrameHeight_0323CD28.jpg"&gt;&lt;IMG title=IE8IFrameHeight style="BORDER-RIGHT:0px;BORDER-TOP:0px;DISPLAY:inline;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height=244 alt=IE8IFrameHeight src="http://www.atalasoft.com/cs/blogs/davidcilley/IE8IFrameHeight_thumb_334DA89C.jpg" width=172 border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;;subject=Internet+Explorer+8+IFrame+Height+Nesting+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;;title=Internet+Explorer+8+IFrame+Height+Nesting+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;title=Internet+Explorer+8+IFrame+Height+Nesting+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;;title=Internet+Explorer+8+IFrame+Height+Nesting+Bug" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx&amp;amp;;title=Internet+Explorer+8+IFrame+Height+Nesting+Bug&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=17338" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author></entry><entry><title>Introducing AJAX based Freehand, Polygon, and Lines Annotations</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx</id><published>2009-01-26T15:52:00Z</published><updated>2009-01-26T15:52:00Z</updated><content type="html">&lt;P&gt;&lt;A href="http://www.atalasoft.com/ajaxannotations/default.aspx" target=_blank&gt;&lt;IMG title=new_annos style="BORDER-RIGHT:0px;BORDER-TOP:0px;DISPLAY:inline;MARGIN:0px 0px 0px 10px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height=250 alt=new_annos src="http://www.atalasoft.com/cs/blogs/davidcilley/new_annos_1B91E66A.jpg" width=260 align=right border=0&gt;&lt;/A&gt;If you haven’t already made it over to our &lt;A href="http://www.atalasoft.com/ajaxannotations/default.aspx" target=_blank&gt;DotImage 7.0 AJAX Annotations Demo&lt;/A&gt;, I&amp;nbsp; encourage you to take a look.&amp;nbsp; This demonstrates our new JavaScript annotation editors, which are based on the client side Canvas object.&amp;nbsp; We’re keeping with our zero-footprint tradition, and supporting most browsers: Internet Explorer 6-8, Firefox 2-3, Apple Safari, Google Chrome, and Opera 9. This demo was created using &lt;A href="http://www.atalasoft.com/products/dotimage/default.aspx" target=_blank&gt;DotImage 7.0&lt;/A&gt;, &lt;A href="http://www.atalasoft.com/products/dotimage/adc/default.aspx" target=_blank&gt;DotImage Advanced Document Cleanup (ADC)&lt;/A&gt;, and &lt;A href="http://developer.yahoo.com/yui/" target=_blank&gt;YUI&lt;/A&gt; (for the dialogs, right click menu, color picker, and animation).&lt;/P&gt;
&lt;P&gt;Here’s what’s new:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Annotations that can now be created with the mouse&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Freehand&lt;/LI&gt;
&lt;LI&gt;Lines&lt;/LI&gt;
&lt;LI&gt;Polygon&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;These annotations have had their client side editors improved&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ellipse&lt;/LI&gt;
&lt;LI&gt;Rectangle (Including highlighter, redaction, etc)&lt;/LI&gt;
&lt;LI&gt;Line&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;We’ve also made several improvements to the WebThumbnailViewer, allowing it to load large numbers of thumbnails without affecting performance.&lt;/P&gt;
&lt;P&gt;Here is a more detailed list of &lt;A href="http://www.atalasoft.com/products/dotimage/newfeatures/dotimage70/default.aspx" target=_blank&gt;DotImage 7.0 new features&lt;/A&gt;.&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;;subject=Introducing+AJAX+based+Freehand%2c+Polygon%2c+and+Lines+Annotations" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;;title=Introducing+AJAX+based+Freehand%2c+Polygon%2c+and+Lines+Annotations" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;title=Introducing+AJAX+based+Freehand%2c+Polygon%2c+and+Lines+Annotations" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;;title=Introducing+AJAX+based+Freehand%2c+Polygon%2c+and+Lines+Annotations" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx&amp;amp;;title=Introducing+AJAX+based+Freehand%2c+Polygon%2c+and+Lines+Annotations&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=17321" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="ASP.NET" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>Converting YUI ButtonGroups into Image Buttons</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx</id><published>2009-01-21T22:28:00Z</published><updated>2009-01-21T22:28:00Z</updated><content type="html">&lt;P&gt;ButtonGroups in YUI are fairly quick to implement, have a nice look, and act the way most people expect.&amp;nbsp; I’ve been surprised to find out that there are no options available to use images in place of the text on the Buttons inside the ButtonGroup.&lt;/P&gt;
&lt;P&gt;In our most recent AJAX Photo Viewer Demo, I decided to use a ButtonGroup for the main mouse tool controls, and &lt;A href="http://www.atalasoft.com/cs/blogs/billbither/default.aspx"&gt;Bill Bither&lt;/A&gt; suggested that I use icons instead of text.&lt;/P&gt;
&lt;P&gt;I didn’t want to throw away what I’d done so far, since the demo was pretty much done at that point.&amp;nbsp; I poked around YUI’s documentation a bit and came up with simple function that can convert a YUI Button into an image only button, much like a button on a tool bar.&amp;nbsp; These converted YUI Buttons still maintain the same original properties internally, so you can use them interchangeably.&lt;/P&gt;
&lt;P&gt;Here’s a quick demonstration:&lt;/P&gt;
&lt;P&gt;&lt;IFRAME style="WIDTH:100%;HEIGHT:104px;" border=0 marginWidth=0 marginHeight=0 src="http://www.flashxsfx.com/BlogDemos/YUIImageButtons/" frameBorder=0 width="100%" scrolling=no height=150&gt;&lt;/IFRAME&gt;&lt;/P&gt;
&lt;P&gt;Here’s what you need: &lt;BR&gt;&lt;STRONG&gt;YUI Dependencies:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;&amp;lt;!-- Combo-handled YUI CSS files: --&amp;gt;&lt;/SPAN&gt;  
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;link&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;rel&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"stylesheet"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"text/css"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;href&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"http://yui.yahooapis.com/combo?2.6.0/build/button/assets/skins/sam/button.css"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#0000ff;"&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;&amp;lt;!-- Combo-handled YUI JS files: --&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;script&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"text/javascript"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;src&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&amp;amp;2.6.0/build/element/element-beta-min.js&amp;amp;2.6.0/build/button/button-min.js"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;script&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;CSS:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;/* Our new icon class */&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;.&lt;SPAN style="COLOR:#800000;"&gt;icon&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;{
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;background-repeat&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;no-repeat&lt;/SPAN&gt;;  
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;background-position&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;2px 2px&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;cursor&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;pointer&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;overflow&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;hidden&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;height&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;28px&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#ff0000;"&gt;width&lt;/SPAN&gt;: &lt;SPAN style="COLOR:#0000ff;"&gt;28px&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;HTML:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;id&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"mainContainer"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;&amp;lt;!-- This is where the button bar will be created --&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"padding-top: 10px;"&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;input&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"button"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"Convert to Image Buttons"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#ff0000;"&gt;onclick&lt;/SPAN&gt;=&lt;SPAN style="COLOR:#0000ff;"&gt;"return onConvertClick();"&lt;/SPAN&gt; &lt;SPAN style="COLOR:#0000ff;"&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR:#800000;"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;Java&amp;nbsp;Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="OVERFLOW:auto;"&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; _mainButtonGroup = &lt;SPAN style="COLOR:#0000ff;"&gt;null&lt;/SPAN&gt;;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;// An array of arrays containing the label/value of each button, and its corresponding tooltip&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;// The label of each of these buttons will be used as the base filename for the icon.&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; _mainButtonData = [
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Pan', 'Left click and drag to pan the image.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Center', 'Left click anywhere on the image to re-center the control\'s position.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Selection', 'Click and drag to make a rectangular selection. Click outside the selection to remove it.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Ellipse', 'Click and drag to make a rectangular selection. An ellipse will be rendered inside the selected area.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Rectangle', 'Click and drag to make a rectangular selection. A rectangle will be rendered inside the selected area.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Text', 'Click and drag to make a rectangular selection. Sample text will be rendered inside the selected area.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Image', 'Click and drag to make a rectangular selection. An image will be rendered inside the selected area.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['Zoom', 'Left click anywhere on the image to zoom &lt;SPAN style="COLOR:#0000ff;"&gt;in&lt;/SPAN&gt;, right click to zoom out.'],
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	['ZoomSelection', 'Click and drag to make a rectangular selection. The area you select will be zoomed into.']
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;]
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;		
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;// Create the button group when the page is ready&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;YAHOO.util.Event.onDOMReady(onPageLoad);
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; onPageLoad(){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	createButtonGroup();
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;		
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; createButtonGroup(){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Create new YUI button group on the 'mainContainer' div&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	_mainButtonGroup = &lt;SPAN style="COLOR:#0000ff;"&gt;new&lt;/SPAN&gt; YAHOO.widget.ButtonGroup({id:'mainButtonGroup', container: 'mainContainer'});
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Add some buttons to the group&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#0000ff;"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; i = 0; i &amp;lt; _mainButtonData.&lt;SPAN style="COLOR:#0000ff;"&gt;length&lt;/SPAN&gt;; i++){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;		_mainButtonGroup.addButton({label: _mainButtonData[i][0], value: _mainButtonData[i][0] });
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;			
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Render the new button group&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	_mainButtonGroup.render();
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;		
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;// Simple demo function that runs the converter function&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; onConvertClick(){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; buttons = _mainButtonGroup.getButtons();
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;			
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Loop through the Button array and convert each button&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#0000ff;"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; i = 0; i &amp;lt; buttons.&lt;SPAN style="COLOR:#0000ff;"&gt;length&lt;/SPAN&gt;; i++){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;		convertButtonToImageButton(buttons[i], _mainButtonData[i][1]);
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#008000;"&gt;// Main converter&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;SPAN style="COLOR:#0000ff;"&gt;function&lt;/SPAN&gt; convertButtonToImageButton(button, tooltip){
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// We use the value of the the button for the icon name&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#0000ff;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="COLOR:#0000ff;"&gt;name&lt;/SPAN&gt; = button.get('value');
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Use the icon as a background image&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// It's entirely possible for you to use the CSS sprite method here, by &lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// incrementing the background offset rather than using different names&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	button._button.parentNode.style.backgroundImage = 'url(icons/' + &lt;SPAN style="COLOR:#0000ff;"&gt;name&lt;/SPAN&gt; + '.png)';
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Add our new icon class to the existing classes&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	button._button.parentNode.className += ' icon';
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Add tooltip to the parent node&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	button._button.parentNode.title = tooltip;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	&lt;SPAN style="COLOR:#008000;"&gt;// Hide the text of the button&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;	button._button.style.visibility = 'hidden';
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;}
&lt;/PRE&gt;&lt;PRE style="FONT-SIZE:12px;MARGIN:0em;WIDTH:100%;FONT-FAMILY:consolas,'Courier New',courier,monospace;BACKGROUND-COLOR:#ffffff;"&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;;subject=Converting+YUI+ButtonGroups+into+Image+Buttons" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;;title=Converting+YUI+ButtonGroups+into+Image+Buttons" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;title=Converting+YUI+ButtonGroups+into+Image+Buttons" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;;title=Converting+YUI+ButtonGroups+into+Image+Buttons" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx&amp;amp;;title=Converting+YUI+ButtonGroups+into+Image+Buttons&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=17284" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>Using YUI Test to unit test Atalasoft WebControls</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx</id><published>2008-12-03T20:01:00Z</published><updated>2008-12-03T20:01:00Z</updated><content type="html">&lt;P&gt;Yesterday I read an informative article on &lt;A class="" href="http://yuiblog.com/blog/2008/12/01/yuitest-getting-started/" target=_blank&gt;how to get started using&amp;nbsp;YUI Test to write unit tests for&amp;nbsp;JavaScript&lt;/A&gt;, by&amp;nbsp;Nicholas C. Zakas.&amp;nbsp; After reading this article, I decided to give it a try, by testing some functions of the WebImageViewer and the WebThumbnailViewer controls.&lt;/P&gt;
&lt;P&gt;It took me all of about 15 minutes to write this demo, while following the instructions, and a few more minutes polishing it up for this post.&amp;nbsp; I am really impressed how easy YUI Test is to work with, and how quickly I was able to get up and running.&lt;/P&gt;
&lt;P&gt;Kudos to the YUI team!&lt;/P&gt;
&lt;P&gt;Here's a link to my online &lt;A class="" href="http://www.flashxsfx.com/BlogDemos/YUITestDemo/" target=_blank&gt;YUI Test Unit Testing Demo&lt;/A&gt;, and here's the code:&lt;BR&gt;&lt;BR&gt;
&lt;DIV style="PADDING-RIGHT:6px;PADDING-LEFT:6px;PADDING-BOTTOM:6px;OVERFLOW:scroll;PADDING-TOP:6px;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;BR&gt;&amp;lt;head id="Head1" runat="server"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;YUI Test Unit Testing Demo&amp;lt;/title&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;!--CSS--&amp;gt;&lt;BR&gt;  &amp;lt;link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/logger/assets/logger.css" /&amp;gt;&lt;BR&gt;  &amp;lt;link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/yuitest/assets/testlogger.css" /&amp;gt;

&lt;P&gt;  &amp;lt;!-- Combo-handled YUI JS files: --&amp;gt;&lt;BR&gt;  &amp;lt;script type="text/javascript" src="http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&amp;amp;2.6.0/build/logger/logger-min.js&amp;amp;2.6.0/build/yuitest/yuitest-min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR&gt;&amp;lt;/head&amp;gt;&lt;BR&gt;&amp;lt;body&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;form id="form1" runat="server"&amp;gt;&lt;BR&gt;  &amp;nbsp; &amp;lt;div&amp;gt;Using YUI Test to Unit Test Atalasoft WebControls&amp;lt;/div&amp;gt;&lt;BR&gt;  &amp;nbsp; &amp;lt;div style="height:800px;"&amp;gt;&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;lt;table border="0" cellpadding="0" cellspacing="2" style="width:100%; height:100%"&amp;gt;&lt;BR&gt;    &amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt;&amp;lt;td colspan="2" style="width:100%; height:36px;"&amp;gt;&lt;BR&gt;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type="button" onclick="OpenTestImage(); return false;" value="Open Image and run tests"&amp;nbsp; /&amp;gt;&lt;BR&gt;     &amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;BR&gt;    &amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt;&amp;lt;td style="width:200px; height:100%; border: 1px solid black; background-color:Silver"&amp;gt;&lt;BR&gt;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;cc1:WebThumbnailViewer ID="WebThumbnailViewer1" runat="server"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Width="150px"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Height="100%"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TitleBar="Thumbs"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ViewerID="WebImageViewer1"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Centered="true"&amp;nbsp;/&amp;gt;&lt;BR&gt;       &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;td style="width:100%; height:100%; border: 1px solid black; background-color:Silver"&amp;gt;&lt;BR&gt;       &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;cc1:WebImageViewer ID="WebImageViewer1" runat="server"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Width="100%"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Height="100%"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AutoZoom="BestFit"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AntialiasDisplay="ScaleToGray"&lt;BR&gt;          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TitleBar="Image" /&amp;gt;&lt;BR&gt;          &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;BR&gt;     &amp;nbsp;&amp;nbsp; &amp;lt;/table&amp;gt;&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;BR&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;var _testUrl = 'Images/DocCleanMultipage.tif';&lt;BR&gt;&amp;nbsp;&amp;nbsp;var _testIndex = 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;var _logger = null;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;// Runs once the page has finished loading &lt;BR&gt;&amp;nbsp;&amp;nbsp;atalaInitClientScript(Init);&lt;BR&gt;&amp;nbsp;&amp;nbsp;function Init(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitEvents();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitTests();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Bind our event handlers&lt;BR&gt;&amp;nbsp;&amp;nbsp;function InitEvents(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebThumbnailViewer1.UrlChanged = UrlLoaded;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebThumbnailViewer1.SelectedIndexChanged = IndexChanged;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // We use ImageSizeChanged because this event fires when&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // a callback is returned from the server, ImageChanged fires immediately&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebImageViewer1.ImageSizeChanged = ImageLoaded;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Set up the test functions&lt;BR&gt;&amp;nbsp;&amp;nbsp;function InitTests(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var testCase = new YAHOO.tool.TestCase({&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp;name: "Open Image Tests",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  testUrlLoaded : function(){&lt;BR&gt; &amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;&amp;nbsp;// tests whether the url given is the one that was loaded in the WebThumbnailViewer&lt;BR&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp;YAHOO.util.Assert.areEqual(_testUrl, WebThumbnailViewer1.getUrl());&lt;BR&gt;&amp;nbsp;  &amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;testSelectedIndex : function(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp;// tests that the index given is returned as being selected in the WebThumbnailViewer&lt;BR&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;YAHOO.util.Assert.areEqual(_testIndex, WebThumbnailViewer1.getSelectedIndex());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   },&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;testImageLoaded : function(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp;// tests whether the url given is the one that was loaded in the WebImageViewer&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   YAHOO.util.Assert.areEqual(_testUrl, WebImageViewer1.getImageUrl());&lt;BR&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp;testFrameIndex : function(){&lt;BR&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// tests that the given selected index was the index loaded into the WebImageViewer&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;YAHOO.util.Assert.areEqual(_testIndex, WebImageViewer1.getFrameIndex());&lt;BR&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;  });&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;   &amp;nbsp;// Add the test case to the test runner&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; YAHOO.tool.TestRunner.add(testCase);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Create the logger (shows it too)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_logger = new YAHOO.tool.TestLogger("testLogger");&lt;BR&gt;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Select a thumbnail once the image has been loaded into the thumbnailviewer&lt;BR&gt;&amp;nbsp;&amp;nbsp;function UrlLoaded(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WebThumbnailViewer1.SelectThumb(_testIndex);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Change the test's selected index, so that clicking on a thumb will test that index&lt;BR&gt;&amp;nbsp;&amp;nbsp;function IndexChanged(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_testIndex = WebThumbnailViewer1.getSelectedIndex();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// We want to run the tests after the callback from the server&lt;BR&gt;&amp;nbsp;&amp;nbsp;// If this were an automated test, this should have a time limit&lt;BR&gt;&amp;nbsp;&amp;nbsp;// so we can run the tests even if there is no response from the server&lt;BR&gt;&amp;nbsp;&amp;nbsp;function ImageLoaded(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;RunTests();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Run the tests&lt;BR&gt;&amp;nbsp;&amp;nbsp;function RunTests(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;YAHOO.tool.TestRunner.run();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Open the test image&lt;BR&gt;&amp;nbsp;&amp;nbsp;function OpenTestImage(){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WebThumbnailViewer1.OpenUrl(_testUrl);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;lt;/script&amp;gt;&lt;BR&gt;  &amp;lt;/form&amp;gt;&lt;BR&gt;&amp;lt;/body&amp;gt;&lt;BR&gt;&amp;lt;/html&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;;subject=Using+YUI+Test+to+unit+test+Atalasoft+WebControls" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;;title=Using+YUI+Test+to+unit+test+Atalasoft+WebControls" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;title=Using+YUI+Test+to+unit+test+Atalasoft+WebControls" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;;title=Using+YUI+Test+to+unit+test+Atalasoft+WebControls" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx&amp;amp;;title=Using+YUI+Test+to+unit+test+Atalasoft+WebControls&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=16743" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="Unit Testing" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Unit+Testing/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>Ajax Image Sliders Part 3: Intervals with Opacity</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx</id><published>2008-04-28T19:20:00Z</published><updated>2008-04-28T19:20:00Z</updated><content type="html">&lt;P&gt;This is Part&amp;nbsp;3 of a&amp;nbsp;multi-part blog series.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;The&amp;nbsp;OnDemand method&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;The Interval method&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;The Interval Opacity method&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;On the previous two slider examples, I used a YUI slider that had a range from -100 to 100, with a total of 201 possible&amp;nbsp;values.&amp;nbsp; Both of these examples still have some&amp;nbsp;disconnect from the action performed, and still feel like we're on the web.&amp;nbsp; I promised that we could improve upon this, and I don't mean by adding more intervals... there's one more browser trick we can use to get this right.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Interval Opacity Method&lt;BR&gt;&lt;/STRONG&gt;This is possibly the most responsive method for using sliders with images in the native browser.&amp;nbsp; This method builds upon the Interval method by using browser native opacity to 'create' the missing&amp;nbsp;steps between the intervals that we've already downloaded.&amp;nbsp; This also removes the OnDemand portion that was causing the flicker in &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;Part 2&lt;/A&gt;.&amp;nbsp; Two&amp;nbsp;image tags are shown in this method, one on top of the other, the the top one partially opaque depending on the percentage between intervals.&lt;/P&gt;
&lt;P&gt;Without changing the server side code of &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;Part 1&lt;/A&gt;,&amp;nbsp;and making a few changes to the&amp;nbsp;client side code that we've built&amp;nbsp;in &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;Part 2&lt;/A&gt;,&amp;nbsp;we get a&amp;nbsp;visual update for every available value of the slider.&amp;nbsp; As of this posting, this method works in IE 5.5/6/7, Mozilla Firefox, Safari, and Opera.&lt;/P&gt;
&lt;P&gt;Here's the demo:&lt;/P&gt;
&lt;P&gt;&lt;IFRAME border=0 marginWidth=0 marginHeight=0 src="http://www.flashxsfx.com/blogdemos/SliderDemo/Slider_IntervalOpacity.aspx" frameBorder=0 width=320 scrolling=no height=290&gt;&lt;/IFRAME&gt;&lt;/P&gt;
&lt;P&gt;Here's what you need:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;An input tag to hold/edit the value (I used a text box)&lt;/LI&gt;
&lt;LI&gt;A JavaScript slider control (YUI slider in this example)&lt;/LI&gt;
&lt;LI&gt;Some JavaScript event handlers&lt;/LI&gt;
&lt;LI&gt;A server side method that returns an updated image from a querystring containing a path and a change value&lt;/LI&gt;
&lt;LI&gt;A loop that creates a series of img tags on page load, and pre-populates them with images (client side)&lt;/LI&gt;
&lt;LI&gt;A method that shows and hides the tags as they are needed (client side)&lt;/LI&gt;
&lt;LI&gt;A method that shows partially opaque images, using style.opacity or style.filter = alpha(value) for IE&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The server side code for this example is attached&amp;nbsp;the &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;Part 1&amp;nbsp;article&lt;/A&gt;, I have provided the&amp;nbsp;client-side&amp;nbsp;code&amp;nbsp;inline:&lt;/P&gt;
&lt;DIV style="PADDING-RIGHT:6px;PADDING-LEFT:6px;PADDING-BOTTOM:6px;OVERFLOW:scroll;PADDING-TOP:6px;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt; &amp;lt;!-- YUI Dependencies --&amp;gt;&lt;BR&gt; &amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;lt;!-- XHTML --&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;div id="container"&amp;gt;&amp;lt;asp:Image ID="Image1" runat="server" ImageUrl="images/spacer.gif" Width="320" Height="240" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;div style="padding-left:6px;"&amp;gt;Gamma&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;div id="sliderbg" style="position:relative; background:url(images/bg-fader.gif) 5px 0 no-repeat; height:28px; width:228px;"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &amp;lt;div id="sliderthumb" style="position: absolute; top: 4px;"&amp;gt;&amp;lt;img src="images/thumb-n.gif" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;input id="gammaVal" maxlength="4" size="4" type="text" value="0" style="position:relative; left:230px; top:-24px;" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/div&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt; &amp;lt;script type="text/javascript"&amp;gt;&lt;BR&gt;	var _slider;&lt;BR&gt;	var _gammaVal = document.getElementById('gammaVal');&lt;BR&gt;	var _url = 'Images/Rosebud.jpg'; // Starting image url&lt;BR&gt;	var _path = '&amp;lt;%= this.Page.Request.CurrentExecutionFilePath %&amp;gt;'; // url path of this page&lt;BR&gt;&amp;nbsp;&lt;BR&gt;	var _imgs;&amp;nbsp;// Array used to hold the img tags used for the images&lt;BR&gt;	var _steps = 20;&lt;BR&gt;	var _range = 200;&lt;BR&gt;	var _container = document.getElementById('container');&lt;BR&gt;	var _showing = 0;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;	function init(){&lt;BR&gt;		_slider = YAHOO.widget.Slider.getHorizSlider("sliderbg", "sliderthumb", 0, _range);&lt;BR&gt;		_slider.subscribe('change', chgInterval); // Updates the text field and the image&lt;BR&gt;		&lt;BR&gt;		_imgs = new Array();&lt;BR&gt;		// pre loads the images se we don't have to wait for them to load&lt;BR&gt;	 	for (var g = 0; g &amp;lt;= _steps ; g++){&lt;BR&gt;			var i = new Image();&lt;BR&gt;				i.src = _path + '?img=' + _url + '&amp;amp;gamma=' + (g * (_range / _steps));&lt;BR&gt;				i.style.left = '0px';	&lt;BR&gt;				i.style.top = '0px';&lt;BR&gt;				i.style.position = 'absolute';&lt;BR&gt;				i.style.visibility = 'hidden';&lt;BR&gt;			&lt;BR&gt;			_container.appendChild(i);&lt;BR&gt;			_imgs.push(i);&lt;BR&gt;		}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;		YAHOO.util.Event.on(_gammaVal, "blur", checkValue);&lt;BR&gt;		YAHOO.util.Event.on(_gammaVal, "keydown", keyDown);&lt;BR&gt;		checkValue();&lt;BR&gt;	} &lt;BR&gt;	&lt;BR&gt;	YAHOO.util.Event.onDOMReady(init);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;	// Changes the text field value&lt;BR&gt;	function chgValue(x){&lt;BR&gt;		_gammaVal.value = x - 100;&lt;BR&gt;	}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;	// hides the image at the given interval, and the image overlaying it (if any)&lt;BR&gt;	function hide(i){&lt;BR&gt;		_imgs[i].style.visibility = 'hidden';&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;		if (i + 1 &amp;lt; _imgs.length){&lt;BR&gt;			_imgs[i + 1].style.visibility = 'hidden';&lt;BR&gt;		}&lt;BR&gt;	}&lt;BR&gt;	&lt;BR&gt;	// shows the image at the given interval, and the image overlaying it (if any)&lt;BR&gt;	function show(i){&lt;BR&gt;		_imgs[i].style.visibility = 'visible';&lt;BR&gt;	&lt;BR&gt;		if (i + 1 &amp;lt; _imgs.length){&lt;BR&gt;			_imgs[i + 1].style.visibility = 'visible';&lt;BR&gt;		}&lt;BR&gt;	}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;	// Changes the shown img tag&lt;BR&gt;	function chgInterval(x){&lt;BR&gt;		var shownum = Math.floor(x/(_range/_steps));&lt;BR&gt;		var opacity = Math.round(((x/(_range/_steps)) - shownum) * 100);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;		if (shownum != _showing){&lt;BR&gt;			hide(_showing);&lt;BR&gt;			show(shownum);&lt;BR&gt;			_showing = shownum;&lt;BR&gt;		}&lt;BR&gt;		&lt;BR&gt;		// set the opacity of the overlaying image, to a percentage &lt;BR&gt;		if (_showing + 1 &amp;lt; _imgs.length){&lt;BR&gt;			setOpacity(_imgs[_showing + 1], opacity);&lt;BR&gt;		}&lt;BR&gt;		&lt;BR&gt;		setOpacity(_imgs[_showing], 100);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;		chgValue(x);&lt;BR&gt;	}&lt;BR&gt;	&lt;BR&gt;	// sets the percentage based opacity (0-100) of the given object&lt;BR&gt;	function setOpacity(obj, opacity){&lt;BR&gt;		obj.style.opacity = (opacity / 100);&lt;BR&gt;		obj.style.filter = 'alpha(opacity=' + opacity + ')';&lt;BR&gt;	}&lt;BR&gt;	&lt;BR&gt;	// Checks the value of the text field, and sets the slider to that value&lt;BR&gt;	function checkValue(){&lt;BR&gt;		i = parseInt(_gammaVal.value);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;		if (isNaN(i)){&lt;BR&gt;			i = _slider.getValue() - 100;&lt;BR&gt;		}&lt;BR&gt;			&lt;BR&gt;		_slider.setValue(i + 100, false);&lt;BR&gt;	}&lt;BR&gt;	&lt;BR&gt;	// Used to determine if the enter key has been pressed&lt;BR&gt;	function keyDown(k){&lt;BR&gt;		if (k.keyCode == 13){&lt;BR&gt;			checkValue();&lt;BR&gt;			return false;&lt;BR&gt;		}&lt;BR&gt;	}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;lt;/script&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;;subject=Ajax+Image+Sliders+Part+3%3a+Intervals+with+Opacity" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+3%3a+Intervals+with+Opacity" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;title=Ajax+Image+Sliders+Part+3%3a+Intervals+with+Opacity" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+3%3a+Intervals+with+Opacity" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+3%3a+Intervals+with+Opacity&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13783" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="Sliders" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>Ajax Image Sliders Part 2: Intervals with On Demand</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx</id><published>2008-04-21T14:23:00Z</published><updated>2008-04-21T14:23:00Z</updated><content type="html">&lt;P&gt;This is Part&amp;nbsp;2 of a&amp;nbsp;multi-part blog series.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;The&amp;nbsp;OnDemand method&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;The Interval method&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;The Interval Opacity method&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;On the previous slider example, I used a YUI slider that had a range from -100 to 100.&amp;nbsp; This is a total of 201 different combinations for one image dialog, and that's about 10-20 times more requests&amp;nbsp;than&amp;nbsp;a web server should have to&amp;nbsp;handle in a reasonable amount of time.&amp;nbsp; We want to make this look as if the slider is actually changing the image while we scroll it, but we don't want to request 201 images up front, and we don't want to load them all on demand either.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Interval Method&lt;BR&gt;&lt;/STRONG&gt;This&amp;nbsp;method requests a series of images from the&amp;nbsp;server, at a set interval along the entire slider.&amp;nbsp; These images are requested&amp;nbsp;as the page is loading,&amp;nbsp;new requests are made&amp;nbsp;when the&amp;nbsp;slider has finished moving.&amp;nbsp; The pre-loaded images are stored in their own image tags, hidden and shown when needed.&amp;nbsp; This is along the same lines as many image pre-load scripts that were used for rollovers, many years ago.&lt;/P&gt;
&lt;P&gt;Without changing the server side code of &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;Part 1&lt;/A&gt;, I was able to use this method to create a slider that&amp;nbsp;looks dynamic enough to fool most people into thinking it's changing it on the fly.&amp;nbsp; Because the main image tag is updated to hold the new image when the drag thumb is dropped, there can&amp;nbsp;be a slight flicker.&amp;nbsp; We'll see if we can take care of that in Part 3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the demo for this method:&lt;/P&gt;&lt;IFRAME border=0 marginWidth=0 marginHeight=0 src="http://www.flashxsfx.com/blogdemos/SliderDemo/Slider_OnDemandInterval.aspx" frameBorder=0 width=320 scrolling=no height=290&gt;&lt;/IFRAME&gt;
&lt;P&gt;Here's what you need:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;An img tag&lt;/LI&gt;
&lt;LI&gt;An input tag to hold/edit the value (I used a text box)&lt;/LI&gt;
&lt;LI&gt;A JavaScript slider control (YUI slider in this example)&lt;/LI&gt;
&lt;LI&gt;Some JavaScript event handlers&lt;/LI&gt;
&lt;LI&gt;A server side method that returns an updated image from a querystring containing a path and a change value&lt;/LI&gt;
&lt;LI&gt;A loop that creates a series of img tags on page load, and pre-populates them with images (client side)&lt;/LI&gt;
&lt;LI&gt;A method that shows and hides the tags as they are needed (client side)&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The server side code for this example is attached&amp;nbsp;the &lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;Part 1&amp;nbsp;article&lt;/A&gt;, I have provided the&amp;nbsp;client-side&amp;nbsp;code&amp;nbsp;inline:&lt;/P&gt;
&lt;DIV style="PADDING-RIGHT:6px;PADDING-LEFT:6px;PADDING-BOTTOM:6px;OVERFLOW:scroll;PADDING-TOP:6px;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;lt;!-- YUI Dependencies --&amp;gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;lt;!-- XHTML --&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;div id="container"&amp;gt;&amp;lt;asp:Image ID="Image1" runat="server" ImageUrl="images/spacer.gif" Width="320" Height="240" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;div style="padding-left:6px;"&amp;gt;Gamma&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;div id="sliderbg" style="position:relative; background:url(images/bg-fader.gif) 5px 0 no-repeat; height:28px; width:228px;"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;div id="sliderthumb" style="position: absolute; top: 4px;"&amp;gt;&amp;lt;img src="images/thumb-n.gif" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;input id="gammaVal" maxlength="4" size="3" type="text" value="0" style="position:relative; left:230px; top:-24px;" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/div&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR&gt;&amp;nbsp;var _slider;&lt;BR&gt;&amp;nbsp;var _gammaVal = document.getElementById('gammaVal');&lt;BR&gt;&amp;nbsp;var _img = document.getElementById('&amp;lt;%= this.Image1.ClientID %&amp;gt;');&amp;nbsp; // ASP.NET server control is used for server side access&lt;BR&gt;&amp;nbsp;var _url = 'Images/Rosebud.jpg'; // Starting image url&lt;BR&gt;&amp;nbsp;var _path = '&amp;lt;%= this.Page.Request.CurrentExecutionFilePath %&amp;gt;'; // url path of this page&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;var _imgs;&amp;nbsp;// Array used to hold the img tags used for the images&lt;BR&gt;&amp;nbsp;var _steps = 20;&lt;BR&gt;&amp;nbsp;var _range = 200;&lt;BR&gt;&amp;nbsp;var _container = document.getElementById('container');&lt;BR&gt;&amp;nbsp;var _showing = 0;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;function init(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider = YAHOO.widget.Slider.getHorizSlider("sliderbg", "sliderthumb", 0, _range);&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.subscribe('change', chgInterval); // Updates the text field and the image&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.subscribe('slideEnd', chgImg); // Updates the image&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;_imgs = new Array();&lt;BR&gt;&amp;nbsp;&amp;nbsp;// pre loads the images se we don't have to wait for them to load&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (var g = 0; g &amp;lt;= _steps ; g++){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var i = new Image();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i.src = _path + '?img=' + _url + '&amp;amp;gamma=' + (g * (_range / _steps));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i.style.left = '0px';&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i.style.top = '0px';&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i.style.position = 'absolute';&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i.style.visibility = 'hidden';&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_container.appendChild(i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_imgs.push(i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YAHOO.util.Event.on(_gammaVal, "blur", checkValue);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YAHOO.util.Event.on(_gammaVal, "keydown", keyDown);&lt;BR&gt;&amp;nbsp;&amp;nbsp;checkValue();&lt;BR&gt;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;YAHOO.util.Event.onDOMReady(init);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;// Changes the text field value&lt;BR&gt;&amp;nbsp;function chgValue(x){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_gammaVal.value = x - 100;&lt;BR&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;// Changes the url of the img tag&lt;BR&gt;&amp;nbsp;function chgImg(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_img.src = _path + '?img=' + _url + '&amp;amp;gamma=' + (parseInt(_gammaVal.value) + 100);&lt;BR&gt;&amp;nbsp;&amp;nbsp;hideShowing();&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;function hideShowing(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_imgs[_showing].style.visibility = 'hidden';&lt;BR&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;// Changes the shown img tag&lt;BR&gt;&amp;nbsp;function chgInterval(x){&lt;BR&gt;&amp;nbsp;&amp;nbsp;var shownum = Math.round(x/(_range/_steps));&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (shownum != _showing){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hideShowing();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_showing = shownum;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_imgs[_showing].style.visibility = 'visible';&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;chgValue(x);&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;// Checks the value of the text field, and sets the slider to that value&lt;BR&gt;&amp;nbsp;function checkValue(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;i = parseInt(_gammaVal.value);&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;if (isNaN(i)){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;i = _slider.getValue() - 100;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.setValue(i + 100, false);&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;// Used to determine if the enter key has been pressed&lt;BR&gt;&amp;nbsp;function keyDown(k){&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (k.keyCode == 13){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;checkValue();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;BR&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/SPAN&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;;subject=Ajax+Image+Sliders+Part+2%3a+Intervals+with+On+Demand" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+2%3a+Intervals+with+On+Demand" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;title=Ajax+Image+Sliders+Part+2%3a+Intervals+with+On+Demand" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+2%3a+Intervals+with+On+Demand" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx&amp;amp;;title=Ajax+Image+Sliders+Part+2%3a+Intervals+with+On+Demand&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13725" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="Sliders" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>AJAX Image Sliders: Part 1</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx" /><link rel="enclosure" type="text/plain" length="4511" href="http://www.atalasoft.com/cs/blogs/davidcilley/attachment/13695.ashx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx</id><published>2008-04-16T14:25:00Z</published><updated>2008-04-16T14:25:00Z</updated><content type="html">&lt;P&gt;This is Part 1 of a&amp;nbsp;multi-part blog series.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The&amp;nbsp;OnDemand method&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx"&gt;The Interval method&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx"&gt;The Interval Opacity method&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;One of the most common dialogs in an image editor application is the slider with preview.&amp;nbsp; When you move these applications over to the Web, you end up losing some of the user experience because of the asynchronous nature of these apps.&lt;/P&gt;
&lt;P&gt;There are several ways to use a JavaScript slider to change an image, and I will be covering at least 3 of them over the next few posts.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The "OnDemand" method:&lt;BR&gt;&lt;/STRONG&gt;This is probably the easiest to implement, but least user friendly.&amp;nbsp; I say it's not user friendly because the image only updates after the slider thumb has finished moving.&amp;nbsp; If we were to make the slider update for all points, it would innundate the server with requests.&amp;nbsp; The usage of a slider, however, is still an improvement over a postback or button/text field combination.&amp;nbsp; The feedback from the text box helps the user see that something is happening as well.&lt;/P&gt;
&lt;P&gt;Here's a demonstration:&lt;/P&gt;&lt;IFRAME border=0 marginWidth=0 marginHeight=0 src="http://www.flashxsfx.com/blogdemos/SliderDemo/Slider_OnDemand.aspx" frameBorder=0 width=320 scrolling=no height=290&gt;&lt;/IFRAME&gt;
&lt;P&gt;Here's what you need:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;An img tag&lt;/LI&gt;
&lt;LI&gt;An input tag to hold/edit the value(I used a text box)&lt;/LI&gt;
&lt;LI&gt;A JavaScript slider control (YUI slider in this example)&lt;/LI&gt;
&lt;LI&gt;Some JavaScript event handlers&lt;/LI&gt;
&lt;LI&gt;A server side method that returns an updated image from a querystring containing a path and a change value&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The server side code for this example is attached to this article (if you need it), I have provided the&amp;nbsp;client-side&amp;nbsp;code&amp;nbsp;inline:&lt;/P&gt;
&lt;DIV style="PADDING-RIGHT:6px;PADDING-LEFT:6px;PADDING-BOTTOM:6px;OVERFLOW:scroll;PADDING-TOP:6px;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;PRE&gt;&amp;lt;!-- YUI Dependencies --&amp;gt;&amp;nbsp; &lt;BR&gt;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;lt;script type="text/javascript" src="&lt;A href="http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js%22%3E%3C/script&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;lt;!-- XHTML --&amp;gt;&lt;BR&gt;&amp;lt;div&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;asp:Image ID="Image1" runat="server" ImageUrl="images/spacer.gif" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;div style="padding-left:6px;"&amp;gt;Gamma&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;div id="sliderbg" style="position:relative; background:url(images/bg-fader.gif) 5px 0 no-repeat; height:28px; width:228px;"&amp;gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;div id="sliderthumb" style="position: absolute; top: 4px;"&amp;gt;&amp;lt;img src="images/thumb-n.gif" /&amp;gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;input id="gammaVal" maxlength="4" size="3" type="text" value="0" style="position:relative; left:230px; top:-24px;" /&amp;gt;&lt;BR&gt;&amp;lt;/div&amp;gt;&lt;BR&gt;&lt;BR&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;BR&gt;&amp;nbsp;var _slider;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;nbsp;var _gammaVal = document.getElementById('gammaVal');&lt;BR&gt;&amp;nbsp;var _img = document.getElementById('&amp;lt;%= this.Image1.ClientID %&amp;gt;');&amp;nbsp; // ASP.NET server control is used for server side access&lt;BR&gt;&amp;nbsp;var _url = 'Images/Rosebud.jpg'; // Starting image url&lt;BR&gt;&amp;nbsp;var _path = '&amp;lt;%= this.Page.Request.CurrentExecutionFilePath %&amp;gt;'; // url path of this page&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;function init(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider = YAHOO.widget.Slider.getHorizSlider("sliderbg", "sliderthumb", 0, 200);&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.subscribe('change', chgValue); // Updates the text field while the value is changing&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.subscribe('slideEnd', chgImg); // We only want to change the image after we've finished sliding&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YAHOO.util.Event.on(_gammaVal, "blur", checkValue);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YAHOO.util.Event.on(_gammaVal, "keydown", keyDown);&lt;BR&gt;&amp;nbsp;&amp;nbsp;checkValue();&lt;BR&gt;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;YAHOO.util.Event.onDOMReady(init);&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;nbsp;// Changes the text field value&lt;BR&gt;&amp;nbsp;function chgValue(x){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_gammaVal.value = x - 100;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;nbsp;// Changes the url of the img tag&lt;BR&gt;&amp;nbsp;function chgImg(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;_img.src = _path + '?img=' + _url + '&amp;amp;gamma=' + (parseInt(_gammaVal.value) + 100);&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;// Checks the value of the text field, and sets the slider to that value&lt;BR&gt;&amp;nbsp;function checkValue(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;i = parseInt(_gammaVal.value);&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;nbsp;&amp;nbsp;if (isNaN(i)){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;i = _slider.getValue() - 100;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;_slider.setValue(i + 100, false);&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;// Used to determine if the enter key has been pressed&lt;BR&gt;&amp;nbsp;function keyDown(k){&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (k.keyCode == 13){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;checkValue();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&amp;lt;/script&amp;gt;&lt;BR&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/SPAN&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;;subject=AJAX+Image+Sliders%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;;title=AJAX+Image+Sliders%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;title=AJAX+Image+Sliders%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;;title=AJAX+Image+Sliders%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx&amp;amp;;title=AJAX+Image+Sliders%3a+Part+1&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13695" width="1" height="1"&gt;</content><author><name>David Cilley</name><uri>http://www.atalasoft.com/cs/members/David+Cilley.aspx</uri></author><category term="AJAX" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx" /><category term="JavaScript" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx" /><category term="Sliders" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx" /><category term="YUI" scheme="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx" /></entry><entry><title>Non-Rectangular Masks on the Web: Part 1</title><link rel="alternate" type="text/html" href="http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-part-1.aspx" /><id>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-part-1.aspx</id><published>2008-04-04T19:45:00Z</published><updated>2008-04-04T19:45:00Z</updated><content type="html">&lt;p&gt;Over the past 15 or so years, I've edited and created a thousands of images.&amp;nbsp; I almost always use a mask for something, and it's very rarely only rectangular.&amp;nbsp;I have a need for doing this on the web, natively in the browser, and I might not be the only one.&lt;/p&gt;
&lt;p&gt;With JavaScript and the DOM, you can create a series rectangles that represent masks, but as the complexity of these masks go up, the number of DOM objects that need to be created go up.&amp;nbsp; This can make it slow to render, and slow to update.&lt;/p&gt;
&lt;p&gt;Most of the browsers used today show PNG images with an alpha channel(transparency) correctly.&lt;img src="http://www.atalasoft.com/cs/blogs/davidcilley/files/PNG_Mask.png" style="margin:4px;background-image:url(/cs/blogs/davidcilley/files/Hot_Air_Balloon_thumb.jpg);width:256px;height:256px;" align="right" height="256" width="256"&gt;&amp;nbsp;&amp;nbsp;PNG images with an&amp;nbsp;alpha channel can be used to mimic a client side mask by placing&amp;nbsp;them on top of the object that you want to mask.&amp;nbsp; The image to the right is one of these PNG images, with a JPG image behind it. There are three things you need to do to create a masking PNG image:&lt;br&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create an image with a background color of your choice, at the size of the object you are masking.&lt;/li&gt;
&lt;li&gt;Make the areas you want&amp;nbsp;selected completely transparent on the alpha channel (Black).&lt;/li&gt;
&lt;li&gt;Make the rest of the image half transparent on the alpha channel (Gray).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;The remaining parts that you will need will be some JavaScript mouse events that allow you to drag a box on the object (something like a selection marquee), and a server side method that will create the PNG image described above.&lt;/p&gt;
&lt;p&gt;Since I have access to DotImage, I can use the WebAnnotationViewer and RemoteInvoke to do everything.&amp;nbsp; In my case I decided to use a ReferencedImage annotation to hold the alpha PNG. &amp;nbsp;Here's a basic run down of the concept, using DotImage:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use the WebAnnotationViewer's Selection box to select an area on the image, and attach a JavaScript event to&amp;nbsp;the Selection.Changed.&amp;nbsp; (MaskSelection In this example)&lt;/li&gt;
&lt;li&gt;In the Selection.Changed JavaScript event, use RemoteInvoke to run a&amp;nbsp;Page level server side method that creates the masked PNG image from the selection box. (Remote_MaskSelection in this example)&lt;/li&gt;
&lt;li&gt;The server side method keeps two images in the disk cache.&amp;nbsp; One for 