<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>David Cilley's AJAX Imaging Blog</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/default.aspx</link><description>Thoughts on ASP.NET, AJAX, cross-browser JavaScript, and other thin client technologies.</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>UpdatePanel and Sys.Application.add_load Woes</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/25/updatepanel-and-sys-application-add-load-woes.aspx</link><pubDate>Thu, 25 Jun 2009 23:34:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:18721</guid><dc:creator>David Cilley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/18721.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=18721</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/UpdatePanel/default.aspx">UpdatePanel</category></item><item><title>Internet Explorer TextArea scrollHeight Bug</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/06/23/internet-explorer-textarea-scrollheight-bug.aspx</link><pubDate>Tue, 23 Jun 2009 22:04:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:18707</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/18707.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=18707</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Internet+Explorer/default.aspx">Internet Explorer</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Internet Explorer 8 IFrame Height Nesting Bug</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/28/internet-explorer-8-iframe-height-nesting-bug.aspx</link><pubDate>Wed, 28 Jan 2009 17:42:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:17338</guid><dc:creator>David Cilley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/17338.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=17338</wfw:commentRss><description>&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;</description></item><item><title>Introducing AJAX based Freehand, Polygon, and Lines Annotations</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/26/introducing-ajax-based-freehand-polygon-and-lines-annotations.aspx</link><pubDate>Mon, 26 Jan 2009 15:52:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:17321</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/17321.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=17321</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Converting YUI ButtonGroups into Image Buttons</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2009/01/21/converting-yui-buttongroups-into-image-buttons.aspx</link><pubDate>Wed, 21 Jan 2009 22:28:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:17284</guid><dc:creator>David Cilley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/17284.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=17284</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Using YUI Test to unit test Atalasoft WebControls</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/12/03/using-yui-test-to-unit-test-atalasoft-webcontrols.aspx</link><pubDate>Wed, 03 Dec 2008 20:01:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:16743</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/16743.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=16743</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Unit+Testing/default.aspx">Unit Testing</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Ajax Image Sliders Part 3: Intervals with Opacity</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/28/sliders-part-3-intervals-with-opacity.aspx</link><pubDate>Mon, 28 Apr 2008 19:20:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13783</guid><dc:creator>David Cilley</dc:creator><slash:comments>2</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13783.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13783</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx">Sliders</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Ajax Image Sliders Part 2: Intervals with On Demand</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/21/ajax-image-sliders-part-2-intervals-with-on-demand.aspx</link><pubDate>Mon, 21 Apr 2008 14:23:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13725</guid><dc:creator>David Cilley</dc:creator><slash:comments>6</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13725.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13725</wfw:commentRss><description>&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;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx">Sliders</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>AJAX Image Sliders: Part 1</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/16/ajax-image-sliders-part-1.aspx</link><pubDate>Wed, 16 Apr 2008 14:25:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13695</guid><dc:creator>David Cilley</dc:creator><slash:comments>4</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13695.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13695</wfw:commentRss><description>&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;</description><enclosure url="http://www.atalasoft.com/cs/blogs/davidcilley/attachment/13695.ashx" length="4511" type="text/plain" /><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Sliders/default.aspx">Sliders</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Non-Rectangular Masks on the Web: Part 1</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-part-1.aspx</link><pubDate>Fri, 04 Apr 2008 19:45:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13610</guid><dc:creator>David Cilley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13610.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13610</wfw:commentRss><description>&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 the masked areas drawn, and one for the transparent PNG that represents those masked areas.&lt;/li&gt;
&lt;li&gt;Every time the server side method is called it overwrites these images with the new data from&amp;nbsp;selection rectangle of the WebAnnotationViewer, effectively appending what was selected to the new mask.&lt;/li&gt;
&lt;li&gt;The mask image is an 8-bit&amp;nbsp;grayscale which starts out completely gray (color index 127) to indicate half transparent.&amp;nbsp; Areas that are selected are drawn onto this image as black (index 0).&lt;/li&gt;
&lt;li&gt;The alpha PNG image is a 32-bit RGBA image with a background color (red in this case), and a SetAlphaFromMaskCommand is used to put the mask image into the alpha channel of this new PNG&lt;/li&gt;
&lt;li&gt;The alpha PNG is then added to an annotation on the server side, and the client side JavaScript&amp;nbsp;is notified that it needs to update the annotation.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Here is the code I used to create the mask&amp;nbsp;image and the alpha PNG:&lt;/p&gt;
&lt;div style="padding:6px;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span style="color:black;"&gt;&amp;nbsp;private void SynchronizeMaskAnnotation(Size size)&lt;br&gt;&amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;span&gt;// This annotation was created on PageLoad, and is the only one on layer 0&lt;/span&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;AnnotationUI ann = this.WebAnnotationViewer1.Annotations.GetAnnotation(0, -1, 0);&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;br&gt;&amp;nbsp; &amp;nbsp;ReferencedImageAnnotation refAnn = ann as ReferencedImageAnnotation;&lt;br&gt;&amp;nbsp; &amp;nbsp;if (refAnn != null)&lt;br&gt;&amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;refAnn.Size = size;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ReferencedImageData refAnnData = refAnn.Data as ReferencedImageData;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (refAnnData != null)&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (refAnnData.ImageObject != null)&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;((Bitmap)refAnnData.ImageObject).Dispose();&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GC.Collect(); &lt;span&gt;// This is done because the .NET Bitmap class doesn't free the file in time for us to write over it&lt;/span&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt;&amp;nbsp; &amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;this.WebAnnotationViewer1.UpdateAnnotations();&lt;br&gt;&amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp;private void AppendMask()&lt;br&gt;&amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp;string _pathToCache = System.Configuration.ConfigurationManager.AppSettings["AtalasoftWebControls_Cache"];&lt;br&gt;&amp;nbsp; &amp;nbsp;string _prefix = Page.Session.SessionID + "_";&lt;br&gt;&amp;nbsp; &amp;nbsp;string _pathToMask = this._pathToCache + _prefix + "Mask.png";&lt;br&gt;&amp;nbsp; &amp;nbsp;string _pathToMaskAnn = this._pathToCache + _prefix + "MaskAnn.png";&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;AtalaImage maskImage = null;&lt;br&gt;&amp;nbsp; &amp;nbsp;AtalaImage alphaPNG = null;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;try&lt;br&gt;&amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (File.Exists(Page.MapPath(_pathToMask)))&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;maskImage = new AtalaImage(Page.MapPath(_pathToMask));&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;maskImage = new AtalaImage(this.WebAnnotationViewer1.Image.Size.Width, this.WebAnnotationViewer1.Image.Size.Height, PixelFormat.Pixel8bppGrayscale, Color.Gray);&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;alphaPNG = new AtalaImage(maskImage.Width, maskImage.Height, PixelFormat.Pixel32bppBgra, Color.Red);&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Canvas maskCanvas = new Canvas(maskImage);&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;maskCanvas.DrawRectangle(this.WebAnnotationViewer1.Selection.Rectangle, new SolidFill(Color.Black));&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SetAlphaFromMaskCommand alpha = new SetAlphaFromMaskCommand(maskImage, false, AlphaMergeType.Replace);&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ImageResults results = alpha.Apply(alphaPNG);&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (alphaPNG != results.Image)&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;alphaPNG.Dispose();&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;alphaPNG = results.Image;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SynchronizeMaskAnnotation(alphaPNG.Size);&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;maskImage.Save(Page.MapPath(_pathToMask), new PngEncoder(), null);&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;alphaPNG.Save(Page.MapPath(_pathToMaskAnn), new PngEncoder(), null);&lt;br&gt;&amp;nbsp; &amp;nbsp;}&lt;br&gt;&amp;nbsp; &amp;nbsp;finally&lt;br&gt;&amp;nbsp; &amp;nbsp;{&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (maskImage != null)&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;maskImage.Dispose();&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (alphaPNG != null)&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;alphaPNG.Dispose();&lt;br&gt;&amp;nbsp; &amp;nbsp;}&lt;br&gt;&amp;nbsp;} &lt;/span&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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;;subject=Non-Rectangular+Masks+on+the+Web%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;;title=Non-Rectangular+Masks+on+the+Web%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;title=Non-Rectangular+Masks+on+the+Web%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;;title=Non-Rectangular+Masks+on+the+Web%3a+Part+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-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/04/non-rectangular-masks-on-the-web-part-1.aspx&amp;amp;;title=Non-Rectangular+Masks+on+the+Web%3a+Part+1&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/04/04/non-rectangular-masks-on-the-web-part-1.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13610" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Masking/default.aspx">Masking</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/PNG/default.aspx">PNG</category></item><item><title>Atalasoft at AJAXWorld 2008 East</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx</link><pubDate>Fri, 21 Mar 2008 18:10:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13523</guid><dc:creator>David Cilley</dc:creator><slash:comments>3</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13523.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13523</wfw:commentRss><description>&lt;P&gt;This year's&amp;nbsp;&lt;A class="" href="http://www.ajaxworldexpo.com/" target=_blank&gt;AjaxWorld Conference &amp;amp; Expo&lt;/A&gt; was somewhat of a disappointment.&amp;nbsp; After experiencing the&amp;nbsp;problems&amp;nbsp;that I outlined last year,&amp;nbsp;I anticipated a better overall conference.&amp;nbsp; They did appear to take a few things into consideration,&amp;nbsp;such as the lunch breaks (this time you might have been able to sit down), and the communication of the free wireless access in the ballroom.&amp;nbsp; Very few of the sessions I attended were&amp;nbsp;informative beyond scratching the surface of a particular topic or product.&amp;nbsp; I felt like this conference was still trying to sell me the idea of using AJAX, rather than show us what we (as an AJAX&amp;nbsp;community) have been able accomplish since the last conference.&amp;nbsp; Here's a run down of the&amp;nbsp;problems I saw with this conference, in frustration level order (1 being the most frustrating):&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;This venue is too small.&amp;nbsp; Nearly every single session room was too small for the number of attendees that wanted to attend in any particular session (that I went to).&amp;nbsp; I missed three potentially interesting sessions because I couldn't even get into the room.&amp;nbsp; The sessions where I made it into a seat, still had anywhere from 5-20 people standing in the doorways&amp;nbsp;or sitting on the floor.&lt;/LI&gt;
&lt;LI&gt;Wireless access was still not communicated, but we knew to ask about it this time.&amp;nbsp; There was no way to connect to the internet unless you were in the&amp;nbsp;grand ballroom, most sessions were not in this room.&lt;/LI&gt;
&lt;LI&gt;If you didn't get to lunch or the snack break within the first 5-10 minutes, you might not get any food.&lt;/LI&gt;
&lt;LI&gt;Even though they improved the size of the dining area, there were many people standing and waiting for tables, even some sitting on the floor.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Most session slides were provided online, and not given to us beforehand on a cd (like last year).&amp;nbsp; Without&amp;nbsp;wireless access, this&amp;nbsp;was nearly&amp;nbsp;useless.&lt;/LI&gt;
&lt;LI&gt;They did not&amp;nbsp;enforce&amp;nbsp;the badges at all, everything was open to everyone, regardless of what ticket you paid for. (except meals)&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Sessions I attended:&lt;BR&gt;Day 1:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Comet: The Web That's Instantly On and Always On&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A class="" href="http://www.jroller.com/jonasjacobi/"&gt;Jonas Jacobi&lt;/A&gt; (Kaazing): This was a fairly vague session on Comet.&amp;nbsp; Jonas went over the Bayeux protocol, which is used to do server push(s) to a client browser without plugins.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;ASP.NET AJAX Design &amp;amp; Development Patterns&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A class="" href="http://www.joeon.net/"&gt;Joe Stagner&lt;/A&gt; (Microsoft): This was a great overview on ASP.NET and ASP.NET AJAX design patterns. Joe explained that the UpdatePanel is not always the best way to make an AJAX app, even though it is one of the easiest, because it sends the entire page state back and forth from the server.&amp;nbsp; He covered several models, two of which I found interesting: The Service Model, and the After Processing Model.&amp;nbsp; I recommend taking a look at &lt;A class="" href="http://www.joeon.net/post/2008/03/My-AJAX-World-Downloads---AJAX-Security-amp%3b-AJAX-Patterns-Code-and-PowerPoints.aspx"&gt;his slides&lt;/A&gt;, which he has provided in his blog.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Improving ASP.NET User Interfaces with the AJAX Control Toolkit&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A class="" href="http://aspadvice.com/blogs/robertb/"&gt;Robert Boedigheimer&lt;/A&gt;&amp;nbsp;(The Schwan Food Company): This was a good overview on the ASP.NET AJAX Control Toolkit.&amp;nbsp; He demonstrated several of the controls, but since there was no internet access, he couldn't demonstrate everything that he wanted to.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Day 2:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;I&gt;&lt;B&gt;Can We Fix the Web? &lt;/B&gt;&lt;/I&gt;by &lt;A class="" href="http://www.crockford.com/" target=_blank&gt;Douglas Crockford&lt;/A&gt; (Yahoo!):&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;This was the keynote I was looking forward to, Douglas usually has something good to say.&amp;nbsp; He discussed that security is the main problem with the web.&amp;nbsp; He outlined a three pronged approach to fixing it:&amp;nbsp;&lt;BR&gt;- Safe JavaScript subsets, such as ADsafe, Caja, and Cajita&lt;BR&gt;- Small browser improvements, like JSONRequest, and vats (where only part of the dom is accessible)&lt;BR&gt;- Massive browser improvements, like replacing JavaScript altogether with a new secure language, and&amp;nbsp;creating a common text protocol to replace HTTP&lt;BR&gt;I agree that the Internet and it's components were not designed for many of the things we are doing with it today, but I don't believe that we need to start over.&amp;nbsp; The new and exciting applications that come out every day will push the technology toward where it needs to be.&lt;/LI&gt;
&lt;LI&gt;&lt;I&gt;&lt;B&gt;An Introduction to the YUI Library&lt;/B&gt;&lt;/I&gt; by&amp;nbsp;&lt;A class="" href="http://blog.360.yahoo.com/blog-JG9noGk0aa9kLMDBru_y9a2uxmo-?cq=1"&gt;Eric Miraglia&lt;/A&gt;&amp;nbsp;(Yahoo!): This session was a great look into YUI.&amp;nbsp; I've been using YUI in several of my demos, but I've only scratched the surface of what it's capable of.&amp;nbsp; Some good take-aways were the &lt;A class="" href="http://developer.yahoo.com/yui/compressor/"&gt;YUI compressor&lt;/A&gt;, css &lt;A class="" href="http://developer.yahoo.com/yui/base/"&gt;base&lt;/A&gt; and &lt;A class="" href="http://developer.yahoo.com/yui/reset/"&gt;reset&lt;/A&gt;, &lt;A class="" href="http://developer.yahoo.com/yui/grids/builder/"&gt;YUI CSS Grid&amp;nbsp;Builder&lt;/A&gt;, and the &lt;A class="" href="http://developer.yahoo.com/yui/profiler/"&gt;YUI profiler&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Enterprise Comet: Real-Time, Real-Time, or Real-Time Web 2.0?&lt;/EM&gt; &lt;/STRONG&gt;by &lt;A class="" href="http://www.jroller.com/jonasjacobi/"&gt;Jonas Jacobi&lt;/A&gt;&amp;nbsp;(Kaazing):&amp;nbsp; This was pretty much a condensed version of the previous presentation.&amp;nbsp; We found out that they aren't showing any examples or demos because they are in private beta right now.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;jMaki as an AJAX Mashup Framework&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A class="" href="http://weblogs.java.net/blog/arungupta/"&gt;Arun Gupta&lt;/A&gt;&amp;nbsp;(Sun): This was an interesting concept.&amp;nbsp; jMaki is a level of abstraction that allows objects from different JavaScript libraries to interact with each other.&amp;nbsp; I'm not sure if we could use this in ASP.NET, but it's still a very cool concept.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Understanding the Top Web 2.0 Attack Vectors&lt;/EM&gt; &lt;/STRONG&gt;by Danny Allan (Watchfire): This was another session where there wasn't enough room for everyone.&amp;nbsp;&amp;nbsp;We didn't bother waiting in the hallway, as&amp;nbsp;we couldn't even hear the speaker.&amp;nbsp; I look forward to seeing this one on the DVD.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Writing Large Web Applications Using the YUI&lt;/EM&gt;&lt;/STRONG&gt; by Christian Heilmann (Yahoo!): &amp;nbsp;I had to stand outside in the hallway just to listen to the speaker on this one.&amp;nbsp; It sounded like a great session, but I couldn't take notes or see what he was going over.&amp;nbsp; Hopefully I'll be able to see it when the DVD comes out.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;OpenAjax Gadgets &amp;amp; Widgets&lt;/EM&gt;&lt;/STRONG&gt; by Stewart Nickolas (IBM): This was my introduction to the OpenAjax Alliance.&amp;nbsp; They appear to have the same goal as jMaki, only this is an effort to get everyone to collaborate and contribute.&amp;nbsp; Stewart showed us a really slick mashup and gadget editor that was oriented toward developers.&amp;nbsp; I'm not sure where to find this editor, although I did find &lt;A class="" href="http://www.openajax.org/opensource.php"&gt;this&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Day 3:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Now Playing: Desktop Apps in the Browser!&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A href="http://www.coachwei.com/" target=_blank&gt;Coach Wei&lt;/A&gt; &amp;amp; Bob Buffone (Nexaweb): This was another mildly entertaining ping-pong keynote from&amp;nbsp;Nexaweb.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;DreamFace: The Ultimate Framework for Creating Personalized Web 2.0 Mashups&lt;/EM&gt;&lt;/STRONG&gt; by Olivier Poupeney (DreamFace): I think this was the first session where the speaker actually put together a demo in front of us.&amp;nbsp; Not only was this refreshing, it was a very informative.&amp;nbsp; The framework is looks impressive.&amp;nbsp; I might try&amp;nbsp;making a DreamFace gadget using some Atalasoft controls in the future.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;The Digital Black Belt’s Guide to Building Secure ASP.NET AJAX Applications&lt;/EM&gt;&lt;/STRONG&gt; by &lt;A class="" href="http://www.joeon.net/"&gt;Joe Stagner&lt;/A&gt; (Microsoft): This was the most informative and beneficial session that I went to these three days.&amp;nbsp; Some great take-aways were &lt;A class="" href="http://dawes.za.net/rogan/webscarab/"&gt;WebScarab&lt;/A&gt;, Internet Explorer 8's DOM explorer, ViewState Decoders, and &lt;A class="" href="http://www.contexteditor.org/"&gt;ConTEXT&lt;/A&gt;.&amp;nbsp; His slides can be found &lt;A class="" href="http://www.joeon.net/post/2008/03/My-AJAX-World-Downloads---AJAX-Security-amp%3b-AJAX-Patterns-Code-and-PowerPoints.aspx"&gt;here&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&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/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;;subject=Atalasoft+at+AJAXWorld+2008+East" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.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/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;;title=Atalasoft+at+AJAXWorld+2008+East" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.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/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;title=Atalasoft+at+AJAXWorld+2008+East" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;;title=Atalasoft+at+AJAXWorld+2008+East" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.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/03/21/atalasoft-at-ajaxworld-2008-east.aspx&amp;amp;;title=Atalasoft+at+AJAXWorld+2008+East&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/21/atalasoft-at-ajaxworld-2008-east.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13523" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AjaxWorld/default.aspx">AjaxWorld</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Passing DOM elements from one frame to another</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx</link><pubDate>Sat, 15 Mar 2008 01:35:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13487</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13487.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13487</wfw:commentRss><description>&lt;P&gt;I came across an interesting problem with Internet Explorer and Safari this week:&lt;/P&gt;
&lt;P&gt;I wanted to take an arbitrary html element that had been created on a page, and send it to an iframe that was on the same page.&lt;/P&gt;
&lt;P&gt;I created a simple test page with an iframe, a div tag, and a button.&amp;nbsp; After a few lines of JavaScript, I had it working in FireFox.&amp;nbsp; When I tested it in IE 7, it gave me an "Invalid argument" exception, and didn't specify what was invalid.&amp;nbsp; This doesn't work in Safari either.&amp;nbsp; Opera handles it exactly like FireFox.&lt;/P&gt;
&lt;P&gt;After tinkering with it for a while, I thought it might have something to do with the ownerDocument property on the DOM element.&amp;nbsp;I thought that if I could change that property, that I may be able to&amp;nbsp;get it to work.&amp;nbsp;&amp;nbsp;You can't change this property directly... so I thought maybe by removing the object from the parent object, it would allow me to append it to another document.&amp;nbsp; This doesn't work either.&lt;/P&gt;
&lt;P&gt;Everything that I tried ended up not working, so as a last resort, I decided to create a copy of the&amp;nbsp;element on the child frame.&amp;nbsp; This works for me, but&amp;nbsp;could be missing some attributes that may be important to someone else.&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.atalasoft.com/cs/blogs/davidcilley/files/CrossFrameDomObjects_Test.html" target=_blank&gt;I made a test page&lt;/A&gt; that allows you to test both the direct appendChild method, and the&amp;nbsp;copy code below, while logging all errors that occur.&amp;nbsp; You can see that this test page works in both IE 7 and Safari when the checkbox is checked.&lt;/P&gt;
&lt;P&gt;Here is the code that I used to copy the element on the child frame's document:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT:#cc0000 4px solid;PADDING-RIGHT:6px;BORDER-TOP:#cc0000 4px solid;PADDING-LEFT:6px;PADDING-BOTTOM:6px;BORDER-LEFT:#cc0000 4px solid;PADDING-TOP:6px;BORDER-BOTTOM:#cc0000 4px solid;BACKGROUND-COLOR:#ffddaa;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';"&gt;&lt;SPAN style="COLOR:#708090;"&gt;// o : DOM object to copy&lt;BR&gt;// childDoc : document object from the child frame&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;function CopyToChildObject(o, childDoc){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR:#708090;"&gt;// create a new object on the other document&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;var n = childDoc.createElement(o.tagName);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR:#708090;"&gt;// copy everything inside this tag&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;n.innerHTML = o.innerHTML;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR:#708090;"&gt;// copy attributes &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp; &amp;nbsp;for (var i in o){&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n.setAttribute(i, o.getAttribute(i));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch (e){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN style="COLOR:#708090;"&gt;// do nothing with errors &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR:#708090;"&gt;// copy style &lt;/SPAN&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; for (var i in o.style){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n.style[i] = o.style[i];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (e){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR:#708090;"&gt;// do nothing with errors &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; return n;&lt;BR&gt;} &lt;/SPAN&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/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;;subject=Passing+DOM+elements+from+one+frame+to+another" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.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/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;;title=Passing+DOM+elements+from+one+frame+to+another" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.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/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;title=Passing+DOM+elements+from+one+frame+to+another" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;;title=Passing+DOM+elements+from+one+frame+to+another" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.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/03/14/passing-dom-elements-from-one-frame-to-another.aspx&amp;amp;;title=Passing+DOM+elements+from+one+frame+to+another&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/14/passing-dom-elements-from-one-frame-to-another.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13487" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/IFrame/default.aspx">IFrame</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Using YUI Animation to slide AJAX thumbnails in and out</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx</link><pubDate>Mon, 03 Mar 2008 16:58:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13377</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/13377.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=13377</wfw:commentRss><description>&lt;P&gt;One of the easiest usability improvements that can be made to an imaging application, is the ability to hide the thumbnails from view when they are no longer needed.&amp;nbsp; Most users would prefer to see as much of the image, and as little of the application&amp;nbsp;on the screen as possible.&lt;/P&gt;
&lt;P&gt;Using &lt;A class="" href="http://developer.yahoo.com/yui/animation/"&gt;YUI's&amp;nbsp;Animation Utility&lt;/A&gt;, you can accomplish this task, while adding a little more feedback that something is happening.&lt;/P&gt;
&lt;P&gt;The thumbnails and the main viewer are placed in separate table cells, so that&amp;nbsp;the whole table can be fit to the width of the browser (a common requirement for imaging apps).&amp;nbsp;&amp;nbsp;The object that will be used for the animation, is a div tag (slideAnim in this case)&amp;nbsp;that holds the thumbnails, and clips the content if it's too large.&amp;nbsp;Keep in mind that height and width must be defined on all objects up the tree, if percentage based values need to be used.&lt;/P&gt;
&lt;P&gt;Here's how I did it:&lt;/P&gt;
&lt;P&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.0/build/yahoo-dom-event/yahoo-dom-event.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.0/build/yahoo-dom-event/yahoo-dom-event.js"&amp;gt;&amp;lt;/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.0/build/animation/animation-min.js%22%3E%3C/script"&gt;http://yui.yahooapis.com/2.5.0/build/animation/animation-min.js"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;table style="width:100%;height:630px;"&amp;gt;&lt;BR&gt;&amp;lt;tr&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;td valign="top"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id="slideAnim" style="overflow:hidden; width:202px; height:630px;"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cc1:webthumbnailviewer id="WebThumbnailViewer1" runat="server" width="200px" height="600px" viewerid="WebImageViewer1" thumbsize="160, 120"&amp;gt;&amp;lt;/cc1:webthumbnailviewer&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/div&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;td style="width:100%;" valign="top"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cc1:webimageviewer id="WebImageViewer1" runat="server" height="600px" width="100%" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&lt;BR&gt;&amp;lt;/tr&amp;gt;&lt;BR&gt;&amp;lt;/table&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;button id="demo-run" onclick="return false;"&amp;gt;SlideIn/Out&amp;lt;/button&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;script type="text/javascript"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp; var _vis = true;&lt;BR&gt;&amp;nbsp;&amp;nbsp; var _outAttributes = {&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: { to: 0 }&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var _inAttributes = {&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: { to: 202 }&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// create animation objects&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var _animOut = new YAHOO.util.Anim('slideAnim', _outAttributes, 1, YAHOO.util.Easing.easeOut);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var _animIn = new YAHOO.util.Anim('slideAnim', _inAttributes, 1, YAHOO.util.Easing.easeIn);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// bind events&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;YAHOO.util.Event.on('demo-run', 'click', slide);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_animOut.onComplete.subscribe(onSlideOut);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;_animIn.onComplete.subscribe(onSlideIn);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function onSlideOut(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _vis = false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function onSlideIn(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _vis = true;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; function slide(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_vis){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slideOut();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slideIn();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function slideOut(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _animOut.animate();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function slideIn(){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _animIn.animate();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;lt;/script&amp;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/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;;subject=Using+YUI+Animation+to+slide+AJAX+thumbnails+in+and+out" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.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/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;;title=Using+YUI+Animation+to+slide+AJAX+thumbnails+in+and+out" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.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/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;title=Using+YUI+Animation+to+slide+AJAX+thumbnails+in+and+out" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;;title=Using+YUI+Animation+to+slide+AJAX+thumbnails+in+and+out" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.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/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx&amp;amp;;title=Using+YUI+Animation+to+slide+AJAX+thumbnails+in+and+out&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2008/03/03/using-yui-animation-to-slide-ajax-thumbnails-in-and-out.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13377" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Animation/default.aspx">Animation</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/Thumbnails/default.aspx">Thumbnails</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/YUI/default.aspx">YUI</category></item><item><title>Slick Ajax Magnifier</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx</link><pubDate>Tue, 15 May 2007 19:25:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:12028</guid><dc:creator>David Cilley</dc:creator><slash:comments>5</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/12028.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=12028</wfw:commentRss><description>&lt;P&gt;&lt;IMG title="magnifier screenshot" style="WIDTH:179px;HEIGHT:114px;" height=114 alt="magnifier screenshot" src="http://www.atalasoft.com/cs/blogs/davidcilley/files/magnifier_screenshot.jpg" width=179 align=right&gt;Recently we had a customer ask if we had anything like our WinForms Magnifier MouseTool available on the WebForms side of things.&amp;nbsp; We get this question somewhat frequently, and it's always one of those features that seems to fall off the end of the development cycle to higher priority features.&amp;nbsp; The answer to this question has always been: "It's not inherantly supported, but&amp;nbsp;you could probably make your own by floating another WebImageViewer over the mouse position."&lt;/P&gt;
&lt;P&gt;I spent a little of my free time on it, and I've been able to confirm that this works.&amp;nbsp; Here are the steps that you need to take to get it to work:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a WebForm with two WebImageViewer controls on it, one as the main viewer, and one as the magnifier.&lt;/LI&gt;
&lt;LI&gt;Wrap the magnifier WebImageViewer in a div tag, give the div tag an ID, and set the style to display:none.&lt;/LI&gt;
&lt;LI&gt;Attach a JavaScript&amp;nbsp;MouseDownLeft event to the main viewer.&lt;/LI&gt;
&lt;LI&gt;In the MouseDownLeft event, attach JavaScript MouseMove and MouseUp events to both of the viewers, and set the style of the magnifier div to display:none.&lt;/LI&gt;
&lt;LI&gt;In the MouseMove events, set the position of the magnifier div to the position of the mouse - half the size of the magnifier.&lt;/LI&gt;
&lt;LI&gt;In the MouseUp event, detach the MouseMove and MouseUp events (by setting them to a blank function) and set the magnifier div style to display:none.&lt;/LI&gt;
&lt;LI&gt;The final step is to load the same image into both of the WebImageViewer controls, BestFit the main viewer, and keep the magnifier at zoom level 1.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I have attached a VS 2005 demo solution that shows how all of this is put together.&amp;nbsp;This is a file system based web application with dll.refresh files pointing to the install location of DotImage.&amp;nbsp; If you do not have DotImage installed at that location, you will need to remove and re-add your references to the Atalasoft dll's.&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/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;;subject=Slick+Ajax+Magnifier" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;;title=Slick+Ajax+Magnifier" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;title=Slick+Ajax+Magnifier" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;;title=Slick+Ajax+Magnifier" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.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/2007/05/15/slick-ajax-magnifier.aspx&amp;amp;;title=Slick+Ajax+Magnifier&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/15/slick-ajax-magnifier.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=12028" width="1" height="1"&gt;</description><enclosure url="http://www.atalasoft.com/cs/blogs/davidcilley/attachment/12028.ashx" length="592876" type="application/x-zip-compressed" /><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Presentation: Introduction to AJAX in ASP.NET</title><link>http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx</link><pubDate>Wed, 02 May 2007 18:50:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:11939</guid><dc:creator>David Cilley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/davidcilley/comments/11939.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/davidcilley/commentrss.aspx?PostID=11939</wfw:commentRss><description>&lt;P&gt;I'd like to thank everyone that attended my presentation on AJAX for the &lt;A class="" href="http://wmassdotnet.org/cs/" target=_blank&gt;Western Mass .NET Users Group&lt;/A&gt; last night.&amp;nbsp; I enjoyed presenting to the group and speaking with most of you.&lt;/P&gt;
&lt;P&gt;Topics that were covered were:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;What is AJAX?&lt;/LI&gt;
&lt;LI&gt;AJAX in .NET with IFrames&lt;/LI&gt;
&lt;LI&gt;ASP.NET AJAX Library&lt;/LI&gt;
&lt;LI&gt;ASP.NET AJAX Extensions&lt;/LI&gt;
&lt;LI&gt;ASP.NET AJAX Toolkit&lt;/LI&gt;
&lt;LI&gt;AJAX Annotations Demo&lt;/LI&gt;
&lt;LI&gt;Hero &amp;amp; Villain Card Builder &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you have any questions about the material covered, please don't hesitate to contact me. I'd be happy to answer any questions you might have.&lt;/P&gt;
&lt;P&gt;For reference, I have attached my slides, enjoy!&amp;nbsp;(&lt;EM&gt;Visual Studio 2005 and &lt;A class="" href="http://ajax.asp.net/downloads/default.aspx" target=_blank&gt;ASP.NET AJAX Extensions required&lt;/A&gt;&lt;/EM&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/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;;subject=Presentation%3a+Introduction+to+AJAX+in+ASP.NET" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;;title=Presentation%3a+Introduction+to+AJAX+in+ASP.NET" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;title=Presentation%3a+Introduction+to+AJAX+in+ASP.NET" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;;title=Presentation%3a+Introduction+to+AJAX+in+ASP.NET" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.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/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx&amp;amp;;title=Presentation%3a+Introduction+to+AJAX+in+ASP.NET&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/davidcilley/archive/2007/05/02/presentation-introduction-to-ajax-in-asp-net.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=11939" width="1" height="1"&gt;</description><enclosure url="http://www.atalasoft.com/cs/blogs/davidcilley/attachment/11939.ashx" length="410384" type="application/x-zip-compressed" /><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.atalasoft.com/cs/blogs/davidcilley/archive/tags/IFrame/default.aspx">IFrame</category></item></channel></rss>