<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-5751402505354565177</id><updated>2009-11-05T10:56:10.797-08:00</updated><title type='text'>Ruby on Rails Tutorials &amp; Code Examples</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.insiderpages.com/rubyonrails/atom.xml'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>insiderops</name><uri>http://www.blogger.com/profile/07790219975556550890</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5751402505354565177.post-696412602942769762</id><published>2007-06-19T16:13:00.000-07:00</published><updated>2007-06-22T14:52:37.017-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='search engine optimization'/><category scheme='http://www.blogger.com/atom/ns#' term='title'/><category scheme='http://www.blogger.com/atom/ns#' term='image_tag'/><category scheme='http://www.blogger.com/atom/ns#' term='alt'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Extend rails image_tag to use ALT as TITLE for seo</title><content type='html'>This code snippet will make code like:&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;%= image_tag "rails.png", :alt =&gt; 'rails logo' %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;output (with a title tag):&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt; alt="rails logo" src="/images/rails.png?1182293075"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;title="rails logo"&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Whack the following somewhere (eg. you could test it by sticking it at the end of environment.rb):&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;span class="rails_code"&gt;&lt;br /&gt;# Extend img tag to use the alt text for the title attribute if alt is present &amp; title is empty (for SEO)&lt;br /&gt;module ActionView::Helpers::AssetTagHelper&lt;br /&gt;alias_method :orig_image_tag, :image_tag&lt;br /&gt;def image_tag(source, options = {})&lt;br /&gt;if options[:alt] &amp;amp;&amp;amp; !options[:title]&lt;br /&gt;options[:title] = options[:alt]&lt;br /&gt;end&lt;br /&gt;return orig_image_tag(source, options)&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5751402505354565177-696412602942769762?l=www.insiderpages.com%2Frubyonrails%2Findex.html'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/696412602942769762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5751402505354565177&amp;postID=696412602942769762' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/696412602942769762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/696412602942769762'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/2007/06/extend-rails-imagetag-to-use-alt-as.html' title='Extend rails image_tag to use ALT as TITLE for seo'/><author><name>Jase</name><uri>http://www.blogger.com/profile/07085027985963517038</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00517384997481774863'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5751402505354565177.post-4183955092429697498</id><published>2007-01-19T16:20:00.000-08:00</published><updated>2007-01-19T17:04:56.345-08:00</updated><title type='text'>Silicon Valley Ruby on Rails January 2007 Meetup</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.insiderpages.com/rubyonrails/uploaded_images/CIMG0282-750256.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www2.insiderpages.com/rubyonrails/uploaded_images/CIMG0282-747882.JPG" alt="January 2007 Silicon Valley Ruby on Rails Meetup" title="50 Rails enthusiasts gather at Insider Pages offices on January 18th, 2007." border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Last night was the January gathering of the Silicon Valley Ruby on Rails meetup, and it was the best attended and most successful one yet.  Brian Hawthorne of &lt;a href="http://www.likebetter.com/"&gt;likebetter.com&lt;/a&gt; and &lt;a href="http://earthcode.com/"&gt;Andre Lewis&lt;/a&gt; gave two excellent presentations to a packed room of about 50 Rails enthusiasts.  Brian showed us how he used Rails to build likebetter, touching on how they approached template rendering, their use of Amazon's S3 and EC2 web services, and their experience being a Y Combinator funded company.  Andre introduced the room to the basics of RESTful routing, just in time for yesterday's release of Rails 1.2.  He showed us how to get started using the scaffold_resource generator before diving in to the details of named routes, nested resources and using responds_to to return information in different formats.  He also talked about the motivations and benefits of a RESTful approach to writing controllers.  Check out his slides &lt;a href="http://earthcode.com/about.html#presentations"&gt;here&lt;/a&gt;, as well as his excellent blog post about &lt;a href="http://earthcode.com/blog/2007/01/nested_crud_resources_in_rails.html"&gt;nested CRUD resources&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We'll be doing it again the 3rd Thursday of next month.  Hope to see you there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5751402505354565177-4183955092429697498?l=www.insiderpages.com%2Frubyonrails%2Findex.html'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/4183955092429697498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5751402505354565177&amp;postID=4183955092429697498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/4183955092429697498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/4183955092429697498'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/2007/01/silicon-valley-ruby-on-rails-january.html' title='Silicon Valley Ruby on Rails January 2007 Meetup'/><author><name>Zachary Taylor</name><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5751402505354565177.post-4717555186944278793</id><published>2007-01-17T16:43:00.000-08:00</published><updated>2007-01-17T16:44:01.052-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http_referer'/><category scheme='http://www.blogger.com/atom/ns#' term='keyword highlight'/><category scheme='http://www.blogger.com/atom/ns#' term='request.env[&quot;HTTP_REFERER&quot;]'/><title type='text'>Get Referring Search Engine Keywords from HTTP_REFERER in Ruby on Rails</title><content type='html'>Sometimes you may want to customize a page based on a referring search query for the purpose of Adsense optimization, keyword highlighting or custom logging.&lt;br /&gt;&lt;br /&gt;A good example of this in action is Google's highlighting of search terms in cached pages and HTML versions of indexed PDF documents eg.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_I-YPcKeQzbI/RYwkl_emleI/AAAAAAAAAAY/hEsLLRGnD50/s1600-h/keyword_highlighting.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_I-YPcKeQzbI/RYwkl_emleI/AAAAAAAAAAY/hEsLLRGnD50/s320/keyword_highlighting.gif" alt="" id="BLOGGER_PHOTO_ID_5011420720470070754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;h4&gt;Rails application.rb function:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;# Creates @referring_search containing any referring search engine query minus stop words&lt;br /&gt;#&lt;br /&gt;# eg. If the HTTP_REFERER header indicates page referer as:&lt;br /&gt;#     http://www.google.com/search?q=Most+Calories+iN+a+Cheesesteak+at+Belmont&amp;start=0&amp;amp;amp;ie=utf-8&amp;oe=utf-8&amp;amp;client=firefox-a&amp;rls=org.mozilla:en-US:official&lt;br /&gt;#   &lt;br /&gt;#     then this function will create:&lt;br /&gt;#     @referring_search = "Most Calories Cheesesteak Belmont"&lt;br /&gt;#   &lt;br /&gt;&lt;span class="rails_code"&gt;def setup_referring_keywords&lt;br /&gt;  # Check whether referring URL was a search engine result&lt;br /&gt;  referer = @request.env["HTTP_REFERER"]&lt;br /&gt;  unless referer.nil_or_empty?&lt;br /&gt;    search_referers = [&lt;br /&gt;      [/^http:\/\/(www\.)?google.*/, 'q'],&lt;br /&gt;      [/^http:\/\/search\.yahoo.*/, 'p'],&lt;br /&gt;      [/^http:\/\/search\.msn.*/, 'q'],&lt;br /&gt;      [/^http:\/\/search\.aol.*/, 'userQuery'],&lt;br /&gt;      [/^http:\/\/(www\.)?altavista.*/, 'q'],&lt;br /&gt;      [/^http:\/\/(www\.)?feedster.*/, 'q'],&lt;br /&gt;      [/^http:\/\/search\.lycos.*/, 'query'],&lt;br /&gt;      [/^http:\/\/(www\.)?alltheweb.*/, 'q']&lt;br /&gt;    ]&lt;br /&gt;    query_args =&lt;br /&gt;      begin&lt;br /&gt;        URI.split(referer)[7]&lt;br /&gt;      rescue URI::InvalidURIError&lt;br /&gt;        nil&lt;br /&gt;      end&lt;br /&gt;    search_referers.each do |reg, query_param_name|&lt;br /&gt;      # Check if the referrer is a search engine we are targetting&lt;br /&gt;      if (reg.match(referer))&lt;br /&gt;    &lt;br /&gt;        # Highlight the Search Term Keywords on the page&lt;br /&gt;        #@javascripts.push('keyword_highlighter')&lt;br /&gt;&lt;br /&gt;        # Create a globally scoped variable (@referring_search) containing the referring Search Engine Query&lt;br /&gt;        unless query_args.nil_or_empty?&lt;br /&gt;          query_args.split("&amp;amp;").each do |arg|&lt;br /&gt;            pieces = arg.split('=')&lt;br /&gt;            if pieces.length == 2 &amp;&amp;amp; pieces.first == query_param_name&lt;br /&gt;              unstopped_keywords = CGI.unescape(pieces.last)&lt;br /&gt;              stop_words = /\b(\d+|\w|about|after|also|an|and|are|as|at|be|because|before|between|but|by|can|com|de|do|en|for|from|has|how|however|htm|html|if|i|in|into|is|it|la|no|of|on|or|other|out|since|site|such|than|that|the|there|these|this|those|to|under|upon|vs|was|what|when|where|whether|which|who|will|with|within|without|www|you|your)\b/i&lt;br /&gt;              @referring_search = unstopped_keywords.gsub(stop_words, '').squeeze(' ')&lt;br /&gt;              logger.info("Referring Search Keywords: #{@referring_search}")&lt;br /&gt;              return true&lt;br /&gt;            end&lt;br /&gt;          end&lt;br /&gt;        end&lt;br /&gt;        return true&lt;br /&gt;      end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;  true&lt;br /&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5751402505354565177-4717555186944278793?l=www.insiderpages.com%2Frubyonrails%2Findex.html'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/4717555186944278793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5751402505354565177&amp;postID=4717555186944278793' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/4717555186944278793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/4717555186944278793'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/2007/01/get-referring-search-engine-keywords.html' title='Get Referring Search Engine Keywords from HTTP_REFERER in Ruby on Rails'/><author><name>Jason K</name><uri>http://www.blogger.com/profile/07085027985963517038</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00517384997481774863'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_I-YPcKeQzbI/RYwkl_emleI/AAAAAAAAAAY/hEsLLRGnD50/s72-c/keyword_highlighting.gif' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5751402505354565177.post-7966463493012221052</id><published>2007-01-17T16:41:00.000-08:00</published><updated>2007-01-17T16:42:54.983-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lighttpd'/><category scheme='http://www.blogger.com/atom/ns#' term='alias'/><category scheme='http://www.blogger.com/atom/ns#' term='virtual directory'/><category scheme='http://www.blogger.com/atom/ns#' term='mod_alias'/><title type='text'>Creating &amp; Configuring a Virtual directory Alias in Lighttpd</title><content type='html'>&lt;p&gt;To configure a virtual directory in Lighttpd , you add an 'alias.url' entry to your lighttpd.conf eg:&lt;br /&gt;&lt;h4&gt;lighttpd.conf:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;alias.url = ( "/rubyonrails/" =&gt; "/shared/published/blogger/" )&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Which you would notice is very similar to the Apache Virtual Directory Configuration:&lt;br /&gt;&lt;h4&gt;Apache httpd.conf:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;    Alias /icons/ "C:/Apache/icons/"&lt;br /&gt;&lt;br /&gt;    &lt;directory&gt;&lt;br /&gt;        Options Indexes MultiViews&lt;br /&gt;        AllowOverride None&lt;br /&gt;        Order allow,deny&lt;br /&gt;        Allow from all&lt;br /&gt;    &lt;/directory&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;If you installed Lighttpd without mod_alias, you will probably see:&lt;br /&gt;&lt;h4&gt;lighttpd.conf:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;span class="rails_code"&gt;2007-01-02 14:45:33: (server.c.871) WARNING: unknown config-key: alias.url (ignored)&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This can be fixed by adding a 'mod_alias' entry to your 'server.modules' entry in the lighttpd.conf eg:&lt;br /&gt;&lt;h4&gt;lighttpd.conf:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;server.modules = ("mod_alias", "mod_rewrite", "mod_redirect")&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5751402505354565177-7966463493012221052?l=www.insiderpages.com%2Frubyonrails%2Findex.html'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/7966463493012221052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5751402505354565177&amp;postID=7966463493012221052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/7966463493012221052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/7966463493012221052'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/2007/01/creating-configuring-virtual-directory_17.html' title='Creating &amp; Configuring a Virtual directory Alias in Lighttpd'/><author><name>Jason K</name><uri>http://www.blogger.com/profile/07085027985963517038</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00517384997481774863'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5751402505354565177.post-8990254507126910215</id><published>2007-01-17T16:32:00.001-08:00</published><updated>2007-01-17T16:32:59.310-08:00</updated><title type='text'>In-Screen DHTML Modal Dialog with JavaScript DOM &amp; CSS Opacity</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_I-YPcKeQzbI/RYwekPemldI/AAAAAAAAAAM/OK6gspOET4E/s1600-h/modal_dialog.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_I-YPcKeQzbI/RYwekPemldI/AAAAAAAAAAM/OK6gspOET4E/s320/modal_dialog.gif" alt="" id="BLOGGER_PHOTO_ID_5011414093335533010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;From a usability perspective, the advantage of using an internal DHTML dialog (rather than launching a new window or going to a new page - Internet Explorer's showModalDialog() would be a nice solution but it is not cross-browser) is that the interaction with the dialog remains contextually associated with the disabled page. This means for instance, that when your user wants to provide feedback or add detail to a page on your site, this implementation will visually indicate that the dialog element they are interacting with is inherently associated with the disabled page in the background.&lt;br /&gt;&lt;br /&gt;From a code-maintainability perspective, this may introduce a code overhead that doesn't justify the usability benefit depending on your web applications implementation framework. It seems rather well suited to an 'AJAX'(y) style application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This Tip shows how to create, handle &amp; Display an Image or Photo Upload form in Ruby on Rails&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;DHTML Example:&lt;/h4&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&gt;&lt;br /&gt;&amp;lt;head&gt;&lt;br /&gt;&amp;lt;title&gt;DHTML Non-clickable protection DIV and in-screen modal dialog style display area using JavaScript DOM using CSS Opaque/Opacity filter&amp;lt;/title&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;style type="text/css"&gt;&lt;br /&gt;/* http://www.mandarindesign.com/opacity.html */&lt;br /&gt;#internal_dialog { display:none; position:absolute; top:35px; left:150px; z-index:3; background-color:#6495ED; filter:alpha(opacity=100); -moz-opacity:1.00; opacity:1.00; border:3px solid white; margin:auto; color:white; padding:15px; }&lt;br /&gt;.content_faded {filter:alpha(opacity=50); -moz-opacity:.50; opacity:.50; background-color: #000; z-index:2; position:absolute; left:0px; top:0px; width: 100%; height:100%;}&lt;br /&gt;body, label {font-size:100%; font-family:verdana;}&lt;br /&gt;h1, h2 {margin-bottom:0px; }&lt;br /&gt;p {margin-top:0px;}&lt;br /&gt;&amp;lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;span class="js_code"&gt;var content_shield = null;&lt;br /&gt;var modal_dialog = null;&lt;br /&gt;&lt;br /&gt;function getPageSize(){&lt;br /&gt;var xScroll, yScroll;&lt;br /&gt;if (window.innerHeight &amp;&amp;amp; window.scrollMaxY) {&lt;br /&gt;xScroll = document.body.scrollWidth;&lt;br /&gt;yScroll = window.innerHeight + window.scrollMaxY;&lt;br /&gt;} else if (document.body.scrollHeight &gt; document.body.offsetHeight){ // all but Explorer Mac&lt;br /&gt;xScroll = document.body.scrollWidth;&lt;br /&gt;yScroll = document.body.scrollHeight;&lt;br /&gt;} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari&lt;br /&gt;xScroll = document.body.offsetWidth;&lt;br /&gt;yScroll = document.body.offsetHeight;&lt;br /&gt;}&lt;br /&gt;var windowWidth, windowHeight;&lt;br /&gt;if (self.innerHeight) { // all except Explorer&lt;br /&gt;windowWidth = self.innerWidth;&lt;br /&gt;windowHeight = self.innerHeight;&lt;br /&gt;} else if (document.documentElement &amp;&amp;amp; document.documentElement.clientHeight) { // Explorer 6 Strict Mode&lt;br /&gt;windowWidth = document.documentElement.clientWidth;&lt;br /&gt;windowHeight = document.documentElement.clientHeight;&lt;br /&gt;} else if (document.body) { // other Explorers&lt;br /&gt;windowWidth = document.body.clientWidth;&lt;br /&gt;windowHeight = document.body.clientHeight;&lt;br /&gt;}&lt;br /&gt;// for small pages with total height less then height of the viewport&lt;br /&gt;if(yScroll &amp;lt; windowHeight){&lt;br /&gt;pageHeight = windowHeight;&lt;br /&gt;} else {&lt;br /&gt;pageHeight = yScroll;&lt;br /&gt;}&lt;br /&gt;// for small pages with total width less then width of the viewport&lt;br /&gt;if(xScroll &amp;lt; windowWidth){&lt;br /&gt;pageWidth = windowWidth;&lt;br /&gt;} else {&lt;br /&gt;pageWidth = xScroll;&lt;br /&gt;}&lt;br /&gt;arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)&lt;br /&gt;return arrayPageSize;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function launch_file_upload_internal_dialog() {&lt;br /&gt;//In this example, just display some form elements. This could easily be replaced with a call to an iframe&lt;br /&gt;var dialog_html = "&amp;lt;label for='file_input'&gt;Specify a file to upload:&amp;lt;/label&gt;&amp;lt;input type='file' id='file_input'/&gt;&amp;lt;input type='button' value='submit' onclick='hide_modal_dialog()'/&gt;";&lt;br /&gt;dialog_html += "&amp;lt;input type='button' value='close' onclick='hide_modal_dialog()' style='margin-left:30px;'/&gt;";&lt;br /&gt;show_modal_dialog(dialog_html);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function body_onscroll() {&lt;br /&gt;window.status = getScrollXY();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function show_modal_dialog(dialog_html) {&lt;br /&gt;if (content_shield == null) {&lt;br /&gt;content_shield = document.createElement("div");&lt;br /&gt;content_shield.style.height = getPageSize()[1];&lt;br /&gt;document.body.appendChild(content_shield);&lt;br /&gt;content_shield.className = "content_faded";&lt;br /&gt;window.status="disabled";&lt;br /&gt;//Because the div is only ever going to be the height of the displayable area of the browser (100%),&lt;br /&gt;//it needs to move with the scrollbars (width will always be 100%). We could instead explicitly set&lt;br /&gt;//div height to the complete height of the page including non-visible scrollable areas, but then&lt;br /&gt;//we would need to handle window resize events as well.&lt;br /&gt;//eg. addEvent(document.body, "onscroll", body_onscroll);&lt;br /&gt;}&lt;br /&gt;modal_dialog = document.getElementById("internal_dialog");&lt;br /&gt;modal_dialog.innerHTML = dialog_html;&lt;br /&gt;modal_dialog.style.display = "block";&lt;br /&gt;}&lt;br /&gt;function hide_modal_dialog() {&lt;br /&gt;modal_dialog.style.display = "none";&lt;br /&gt;if (content_shield != null) {&lt;br /&gt;document.body.removeChild(content_shield);&lt;br /&gt;content_shield = null;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function addEvent(obj, evType, fn, useCapture){&lt;br /&gt;//From http://www.scottandrew.com/weblog/articles/cbs-events&lt;br /&gt;if (obj.addEventListener){&lt;br /&gt; obj.addEventListener(evType, fn, useCapture);&lt;br /&gt; return true;&lt;br /&gt;} else if (obj.attachEvent){&lt;br /&gt; var r = obj.attachEvent("on"+evType, fn);&lt;br /&gt; return r;&lt;br /&gt;} else {&lt;br /&gt; alert("Handler could not be attached");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function getScrollXY() {&lt;br /&gt;var scrOfX = 0, scrOfY = 0;&lt;br /&gt;if( typeof( window.pageYOffset ) == 'number' ) {&lt;br /&gt; //Netscape compliant&lt;br /&gt; scrOfY = window.pageYOffset;&lt;br /&gt; scrOfX = window.pageXOffset;&lt;br /&gt;} else if( document.body &amp;&amp;amp; ( document.body.scrollLeft || document.body.scrollTop ) ) {&lt;br /&gt; //DOM compliant&lt;br /&gt; scrOfY = document.body.scrollTop;&lt;br /&gt; scrOfX = document.body.scrollLeft;&lt;br /&gt;} else if( document.documentElement &amp;&amp;amp; ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {&lt;br /&gt; //IE6 standards compliant mode&lt;br /&gt; scrOfY = document.documentElement.scrollTop;&lt;br /&gt; scrOfX = document.documentElement.scrollLeft;&lt;br /&gt;}&lt;br /&gt;return [ scrOfX, scrOfY ];&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&amp;lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&gt;&lt;br /&gt;&amp;lt;div id="internal_dialog"&gt;&amp;lt;/div&gt;&lt;br /&gt;&amp;lt;input type="button" value="Launch Internal Dialog" onclick="launch_file_upload_internal_dialog()"/&gt;&lt;br /&gt;&amp;lt;/body&gt;&lt;br /&gt;&amp;lt;/html&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5751402505354565177-8990254507126910215?l=www.insiderpages.com%2Frubyonrails%2Findex.html'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/8990254507126910215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=5751402505354565177&amp;postID=8990254507126910215' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/8990254507126910215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5751402505354565177/posts/default/8990254507126910215'/><link rel='alternate' type='text/html' href='http://www.insiderpages.com/rubyonrails/2007/01/in-screen-dhtml-modal-dialog-with.html' title='In-Screen DHTML Modal Dialog with JavaScript DOM &amp; CSS Opacity'/><author><name>Jason K</name><uri>http://www.blogger.com/profile/07085027985963517038</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00517384997481774863'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_I-YPcKeQzbI/RYwekPemldI/AAAAAAAAAAM/OK6gspOET4E/s72-c/modal_dialog.gif' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry></feed>