<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: function $</title> <atom:link href="http://quickduck.com/blog/2006/11/16/function/feed/" rel="self" type="application/rss+xml" /><link>http://quickduck.com/blog/2006/11/16/function/</link> <description>Straight from the mind of geniuseseses....</description> <lastBuildDate>Thu, 26 Jan 2012 20:48:40 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: ben</title><link>http://quickduck.com/blog/2006/11/16/function/comment-page-1/#comment-17</link> <dc:creator>ben</dc:creator> <pubDate>Tue, 13 Feb 2007 16:46:05 +0000</pubDate> <guid isPermaLink="false">http://quickduck.com/blog/?p=4#comment-17</guid> <description>And here is another solution that doesn&#039;t require any knowledge of the tagname and type.&lt;pre&gt;&lt;code&gt; /* * Find an element within a page. Works with nested master pages, controls. */ function $(elementId, getElement) { getElement = !getElement ? document.getElementById : getElement; // default to document.getElementById var element = getElement(elementId); if (element != null) { return element; } else if (document.getElementById(&quot;bodyId&quot;) != null) { var rg = new RegExp(&quot;(?:id=\&quot;?)((?:ctl00)(?:[\\$_]*))+(?:[^\\s&gt;]*)(?:[\\$_])&quot; + elementId); var values = rg.exec(document.getElementById(&quot;bodyId&quot;).innerHTML); return getElement(values != null ? values[0].replace(&quot;id=&quot;, &quot;&quot;).replace(&quot;\&quot;&quot;, &quot;&quot;).replace(&quot; &quot;, &quot;&quot;) : elementId); } return null; }Just give your body tag in the Master page an id and replace all references to &quot;bodyId&quot; in the above script to use that id.&lt;/code&gt;&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>And here is another solution that doesn&#8217;t require any knowledge of the tagname and type.</p><pre><code>
/*
 * Find an element within a page. Works with nested master pages, controls.
 */
function $(elementId, getElement) {
    getElement = !getElement ? document.getElementById : getElement; // default to document.getElementById
    var element = getElement(elementId);
    if (element != null) {
        return element;
    } else if (document.getElementById("bodyId") != null) {
        var rg = new RegExp("(?:id=\"?)((?:ctl00)(?:[\\$_]*))+(?:[^\\s>]*)(?:[\\$_])" + elementId);
        var values = rg.exec(document.getElementById("bodyId").innerHTML);
        return getElement(values != null ? values[0].replace("id=", "").replace("\"", "").replace(" ", "") : elementId);
    }
    return null;
}

Just give your body tag in the Master page an id and replace all references to "bodyId" in the above script to use that id.

</code></pre>]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: quickduck.com @ 2012-02-05 17:38:17 -->
