<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>» DoYourself.org &#187; Javascript</title>
	<atom:link href="http://www.doyourself.org/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.doyourself.org</link>
	<description>Did you know ?</description>
	<lastBuildDate>Fri, 03 Feb 2012 23:00:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adding and Removing HTML elements via JavaScript</title>
		<link>http://www.doyourself.org/javascript/545-adding-and-removing-html-elements-via-javascript/</link>
		<comments>http://www.doyourself.org/javascript/545-adding-and-removing-html-elements-via-javascript/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 16:03:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Adding]]></category>
		<category><![CDATA[and]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Removing]]></category>
		<category><![CDATA[via]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=545</guid>
		<description><![CDATA[Sometimes while developing a web application, you need to hide or display certain elements dynamically based on circumstance. For instance, if youâ€™re filling in your personal information and you in the dropdown box you select â€œotherâ€ as your country, the website may be required to display a previously hidden textbox allowing you to type in [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Sometimes while developing a web application, you need to hide or<br />
display certain elements dynamically based on circumstance. For<br />
instance, if youâ€™re filling in your personal information and you in the<br />
dropdown box you select â€œotherâ€ as your country, the website may be<br />
required to display a previously hidden textbox allowing you to type in<br />
your country name.</p>
<p>This post contains two links, written by the same person at two<br />
different times. Which one you choose to use is completely up to your<br />
skill and the scope of the project youâ€™re working on. The first, is a<br />
simple, easy-to-understand Javascript code snippet: <a title="Add / remove html elements in javascript" href="http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/" target="_blank">http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/</a></p>
<p>The second link is a reprise by the same author almost three years<br />
later with a much cleaner implementation of the same functionality in<br />
JavaScript. Unfortunately, it requires more knowledge about JavaScript<br />
and events, and for a beginner in programming, the first link may be<br />
easier to swallow. For the site, click this link: <a title="Add / remove html elements reprise" href="http://www.dustindiaz.com/add-remove-elements-reprise/" target="_blank">http://www.dustindiaz.com/add-remove-elements-reprise/</a></p>
<p>Pick your poison</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/545-adding-and-removing-html-elements-via-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Title Case</title>
		<link>http://www.doyourself.org/javascript/147-javascript-title-case/</link>
		<comments>http://www.doyourself.org/javascript/147-javascript-title-case/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Case]]></category>
		<category><![CDATA[Title]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=147</guid>
		<description><![CDATA[I recently had a project where I needed to quickly convert long strings of uppercase or lowercase text to Title Casing. Normally I would create a PHP script to do this, but they were all on different pages, so it had to be done manually. Rather than manually retype each, I wanted to create a [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I recently had a project where I needed to quickly convert long strings of uppercase or lowercase text to Title Casing. Normally I would create a PHP script to do this, but they were all on different pages, so it had to be done manually. Rather than manually retype each, I wanted to create a JavaScript function to manage it.<span></span></p>
<p>I found some basic code which *mostly* worked to convert text. With some modification, I&#039;ve developed a small text box with the following capabilities:</p>
<li>Converts the text inside the box to title case.</li>
<li>It leaves certain smaller words lower cased (configurable)</li>
<li>As soon as you paste text with your keys (CTRL+V or CMD+V), it does the conversion</li>
<li>It automatically selects all text in the box for you, for easy copying</li>
<p>Here&#039;s the code for you to copy:</p>
<p>&lt;input <span class="kw3">name</span>=<span class="st0">&#034;t&#034;</span> value=<span class="st0">&#034;&#034;</span> type=<span class="st0">&#034;text&#034;</span> size=<span class="st0">&#034;50&#034;</span> <br />
&nbsp; onclick=<span class="st0">&#034;this.select();&#034;</span><br />
&nbsp; onkeyup=<span class="st0">&#034;this.value=titleCaps(this.value);this.select();&#034;</span><br />
/&gt;</p>
<p>&lt;script&gt;<br />
<span class="kw2">function</span> titleCaps<span class="br0">&#040;</span>title<span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> small = <span class="st0">&#034;(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v[.]?|via|vs[.]?)&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> punct = <span class="st0">&#034;([!<span class="es0">"</span>#$%&amp;'()*+,./:;&lt;=&gt;?@[<span class="es0">\</span><span class="es0">\</span><span class="es0">\</span>]^_`{|}~-]*)&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> parts = <span class="br0">&#091;</span><span class="br0">&#093;</span>, split = /<span class="br0">&#091;</span>:.;?!<span class="br0">&#093;</span> |<span class="br0">&#040;</span>?: |^<span class="br0">&#041;</span><span class="br0">&#091;</span><span class="st0">&#034;Ã’]/g, index = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; title = lower(title);<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var m = split.exec(title);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parts.push( title.substring(index, m ? m.index : title.length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(/<span class="es0">b</span>([A-Za-z][a-z.'Ã•]*)<span class="es0">b</span>/g, function(all){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return /[A-Za-z]<span class="es0">.</span>[A-Za-z]/.test(all) ? all : upper(all);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(RegExp(&#034;</span>\b<span class="st0">&#034; + small + &#034;</span>\b<span class="st0">&#034;, &#034;</span>ig<span class="st0">&#034;), lower)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(RegExp(&#034;</span>^<span class="st0">&#034; + punct + small + &#034;</span>\b<span class="st0">&#034;, &#034;</span>ig<span class="st0">&#034;), function(all, punct, word){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return punct + upper(word);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(RegExp(&#034;</span>\b<span class="st0">&#034; + small + punct + &#034;</span>$<span class="st0">&#034;, &#034;</span>ig<span class="st0">&#034;), upper));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index = split.lastIndex;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( m ) parts.push( m[0] );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return parts.join(&#034;</span><span class="st0">&#034;).replace(/ V(s?)<span class="es0">.</span> /ig, &#034;</span> v$<span class="nu0">1</span>. <span class="st0">&#034;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(/(['Ã•])S<span class="es0">b</span>/ig, &#034;</span>$1s<span class="st0">&#034;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(/<span class="es0">b</span>(AT&amp;T|Q&amp;A)<span class="es0">b</span>/ig, function(all){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return all.toUpperCase();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
}<br />
&nbsp; &nbsp; <br />
function lower(word){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return word.toLowerCase();<br />
}<br />
&nbsp; &nbsp; <br />
function upper(word){<br />
&nbsp; return word.substr(0,1).toUpperCase() + word.substr(1);<br />
}<br />
&lt;/script&gt; </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/147-javascript-title-case/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to rotate an image or text with JavaScript &amp; DHTML</title>
		<link>http://www.doyourself.org/javascript/148-how-to-rotate-an-image-or-text-with-javascript-dhtml/</link>
		<comments>http://www.doyourself.org/javascript/148-how-to-rotate-an-image-or-text-with-javascript-dhtml/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[&]]></category>
		<category><![CDATA[an]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[or]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=148</guid>
		<description><![CDATA[So I need to rotate an image every few seconds on a homepage of a site I&#039;m building. I looked around for some pre-built code that I could do this with, and I found a few functions. I picked the one I like the best, and I&#039;ve modified it to my needs. This JavaScript code [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>So I need to rotate an image every few seconds on a homepage of a site I&#039;m building. I looked around for some pre-built code that I could do this with, and I found a few functions. I picked the one I like the best, and I&#039;ve modified it to my needs. This JavaScript code lets you define an array of HTML items (so you could use images, text, links, you name it!), and loop through the array. I added the variable for you to define how many seconds between rotation. Here&#039;s the JavaScript function, it will run automatically on the page load event. Place it in between your &lt;head&gt;&lt;/head&gt; tags.</p>
<p>&lt;script language=<span class="st0">&#034;JavaScript1.2&#034;</span>&gt;</p>
<p><span class="kw2">var</span> howOften = <span class="nu0">2</span>; <span class="co1">//number often in seconds to rotate</span><br />
<span class="kw2">var</span> current = <span class="nu0">0</span>; <span class="co1">//start the counter at 0</span><br />
<span class="kw2">var</span> ns6 = document.<span class="me1">getElementById</span>&amp;&amp;!document.<span class="me1">all</span>; <span class="co1">//detect netscape 6</span></p>
<p><span class="co1">// place your images, text, etc in the array elements here</span><br />
<span class="kw2">var</span> items = <span class="kw2">new</span> Array<span class="br0">&#040;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; items<span class="br0">&#091;</span><span class="nu0">0</span><span class="br0">&#093;</span>=<span class="st0">&#034;&lt;img src=&#039;monkey.gif&#039; border=&#039;0&#039;&gt;&#034;</span>; <span class="co1">//an image</span><br />
&nbsp; &nbsp; items<span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span>=<span class="st0">&#034;&lt;a href=&#039;#&#8217;&gt;&lt;img src=&#039;monkey.gif&#039; border=&#039;0&#039;&gt;&lt;/a&gt;&#034;</span>; <span class="co1">//a linked image</span><br />
&nbsp; &nbsp; items<span class="br0">&#091;</span><span class="nu0">2</span><span class="br0">&#093;</span>=<span class="st0">&#034;Text without a link&#034;</span>;<br />
&nbsp; &nbsp; items<span class="br0">&#091;</span><span class="nu0">3</span><span class="br0">&#093;</span>=<span class="st0">&#034;&lt;a href=&#039;#&#8217;&gt;Text with a link&lt;/a&gt;&#034;</span>;<br />
&nbsp; &nbsp; items<span class="br0">&#091;</span><span class="nu0">4</span><span class="br0">&#093;</span>=<span class="st0">&#034;&lt;a href=&#039;#&#8217;&gt;&lt;img src=&#039;monkey.gif&#039; border=&#039;0&#039;&gt; Text and image with a link&lt;/a&gt;&#034;</span>;</p>
<p><span class="kw2">function</span> rotater<span class="br0">&#040;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#040;</span>document.<span class="me1">layers</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span class="me1">placeholderlayer</span>.<span class="me1">document</span>.<span class="kw1">write</span><span class="br0">&#040;</span>items<span class="br0">&#091;</span>current<span class="br0">&#093;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span class="me1">placeholderlayer</span>.<span class="me1">document</span>.<span class="kw3">close</span><span class="br0">&#040;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#040;</span>ns6<span class="br0">&#041;</span>document.<span class="me1">getElementById</span><span class="br0">&#040;</span><span class="st0">&#034;placeholderdiv&#034;</span><span class="br0">&#041;</span>.<span class="me1">innerHTML</span>=items<span class="br0">&#091;</span>current<span class="br0">&#093;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#040;</span>document.<span class="me1">all</span><span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; placeholderdiv.<span class="me1">innerHTML</span>=items<span class="br0">&#091;</span>current<span class="br0">&#093;</span>;</p>
<p>&nbsp; &nbsp; current = <span class="br0">&#040;</span>current==items.<span class="me1">length</span><span class="br0">&#041;</span> ? <span class="nu0">0</span> : current + <span class="nu0">1</span>; <span class="co1">//increment or reset</span><br />
&nbsp; &nbsp; setTimeout<span class="br0">&#040;</span><span class="st0">&#034;rotater()&#034;</span>,howOften*<span class="nu0">1000</span><span class="br0">&#041;</span>;<br />
<span class="br0">&#125;</span><br />
window.<span class="kw3">onload</span>=rotater;<br />
<span class="co1">//&#8211;&gt;</span><br />
&lt;/script&gt;</p>
<p>Alternately, if you like simpler code, and you don&#039;t care about the .017% of users still using Netscape 6, you can use this JavaScript function for rotater:</p>
<p><span class="kw2">function</span> rotater<span class="br0">&#040;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; document.<span class="me1">getElementById</span><span class="br0">&#040;</span><span class="st0">&#034;placeholder&#034;</span><span class="br0">&#041;</span>.<span class="me1">innerHTML</span> = items<span class="br0">&#091;</span>current<span class="br0">&#093;</span>;<br />
&nbsp; &nbsp; current = <span class="br0">&#040;</span>current==items.<span class="me1">length</span>-<span class="nu0">1</span><span class="br0">&#041;</span> ? <span class="nu0">0</span> : current + <span class="nu0">1</span>;<br />
&nbsp; &nbsp; setTimeout<span class="br0">&#040;</span><span class="st0">&#034;rotater()&#034;</span>,howOften*<span class="nu0">1000</span><span class="br0">&#041;</span>;<br />
<span class="br0">&#125;</span></p>
<p>And here&#039;s the placeholder layers that you need to add to your HTML page to rotate the content in:</p>
<p><span class="sc2">&lt;layer <span class="kw3">id</span>=<span class="st0">&#034;placeholderlayer&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;</span></a>/layer&gt;</span><span class="sc2"><a href="http://december.com/html/4/element/div.html"><span class="kw2">&lt;div</span></a> <span class="kw3">id</span>=<span class="st0">&#034;placeholderdiv&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;/div&gt;</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/148-how-to-rotate-an-image-or-text-with-javascript-dhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Code Preview Box on Your Website</title>
		<link>http://www.doyourself.org/javascript/149-create-a-code-preview-box-on-your-website/</link>
		<comments>http://www.doyourself.org/javascript/149-create-a-code-preview-box-on-your-website/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[a]]></category>
		<category><![CDATA[Box]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[on]]></category>
		<category><![CDATA[Preview]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[your]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=149</guid>
		<description><![CDATA[If you post any client-side code on your website, it would be nice for people to be able to work with it and test or preview it live. This code uses an iframe to enable real-time viewing of your code. You could use this simply as a DHTML code editor, or you could even extend [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>If you post any client-side code on your website, it would be nice for people to be able to work with it and test or preview it live. This code uses an iframe to enable real-time viewing of your code. You could use this simply as a DHTML code editor, or you could even extend it to create your own WYSIWYG editor for your web application!<span></span></p>
<p>If you receive a JavaScript permission error when you&#039;re putting this on a test page, try closing and opening the page instead of just hitting refresh.</p>
<p>Here&#039;s an example of it in use:</p>
<p>          <span>Just change this text/code to whatever code you want to display. Click &#039;run code!&#039; to preview the output of the code.</p>
<p><a href='http://www.justinc-cook.com' target="_o">Free and open web programming scripts</a></span></p>
<p><span class="sc2"><a href="http://december.com/html/4/element/div.html"><span class="kw2">&lt;div</span></a> <span class="kw3">align</span>=<span class="st0">&#034;center&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; <span class="sc2"><a href="http://december.com/html/4/element/table.html"><span class="kw2">&lt;table</span></a> <span class="kw3">style</span>=<span class="st0">&#034;width:500px; border:solid 1px #666;background:#f8f8f8&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/tr.html"><span class="kw2">&lt;tr&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/td.html"><span class="kw2">&lt;td</span></a> <span class="kw3">valign</span>=<span class="st0">&#034;top&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">name</span>=<span class="st0">&#034;form1&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/textarea.html"><span class="kw2">&lt;textarea</span></a> <span class="kw3">name</span>=<span class="st0">&#034;code&#034;</span> wrap=<span class="st0">&#034;soft&#034;</span> <span class="kw3">onclick</span>=<span class="st0">&#034;focus(this.code);&#034;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<span class="kw3">style</span>=<span class="st0">&#034;border:solid 1px #999; padding:5px; width:250px; height:264px; scroll:auto;&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; my test code<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<span class="sc2"><span class="kw2">&lt;/textarea&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/form&gt;</span></span><span class="sc2"><span class="kw2">&lt;/td&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/td.html"><span class="kw2">&lt;td</span></a> <span class="kw3">valign</span>=<span class="st0">&#034;top&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<span class="sc2"><a href="http://december.com/html/4/element/iframe.html"><span class="kw2">&lt;iframe</span></a> <span class="kw3">src</span>=<span class="st0">&#034;about:blank&#034;</span> <span class="kw3">name</span>=<span class="st0">&#034;preview&#034;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="kw3">style</span>=<span class="st0">&#034;border:solid 1px #999;height:275px; width:250px; background:#ffffff&#034;</span> <span class="kw3">frameborder</span>=<span class="st0">&#034;0&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;/iframe&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/td&gt;</span></span><br />
&nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/tr&gt;</span></span><br />
&nbsp; <span class="sc2"><span class="kw2">&lt;/table&gt;</span></span><br />
&nbsp; <span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">type</span>=<span class="st0">&#034;button&#034;</span> <span class="kw3">value</span>=<span class="st0">&#034;run code!&#034;</span><br />
&nbsp; &nbsp;<span class="kw3">onclick</span>=<span class="st0">&#034;preview.document.write(document.form1.code.value); preview.document.close(); preview.focus()&#034;</span> /<span class="kw2">&gt;</span></a></span><br />
&nbsp; <span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">type</span>=<span class="st0">&#034;button&#034;</span> <span class="kw3">value</span>=<span class="st0">&#034;clear&#034;</span><br />
&nbsp; &nbsp;<span class="kw3">onclick</span>=<span class="st0">&#034;document.form1.code.value=&#034;;preview.document.write(document.form1.code.value); preview.document.close(); preview.focus()&#034;</span> /<span class="kw2">&gt;</span></a></span><br />
<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/149-create-a-code-preview-box-on-your-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically Populating Select Menus Client-Side With JavaScript</title>
		<link>http://www.doyourself.org/javascript/150-dynamically-populating-select-menus-client-side-with-javascript/</link>
		<comments>http://www.doyourself.org/javascript/150-dynamically-populating-select-menus-client-side-with-javascript/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[client-side]]></category>
		<category><![CDATA[Dynamically]]></category>
		<category><![CDATA[menus]]></category>
		<category><![CDATA[Populating]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=150</guid>
		<description><![CDATA[This JavaScript function will enable your web application to populate a drop-down menu of items on the fly, based on the selection of another list, without reloading the page. I also provide the code to build the arrays by loading them from a database with ASP and PHP. The ASP code builds JavaScript array of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This JavaScript function will enable your web application to populate a drop-down menu of items on the fly, based on the selection of another list, without reloading the page. I also provide the code to build the arrays by loading them from a database with ASP and PHP.<span></span></p>
<p>The ASP code builds JavaScript array of all possible items that could be populated into the second menu. For each item in the array, it indicates the item in the first menu with which it is associated. So then when the user selects an item in the first list, the function takes the selected value, iterates through the array to find only those items associated with the selected value, and loads them into the second menu.</p>
<p>Here&#039;s the HTML code of the form with the two drop down lists. I&#039;ve hard-coded the first menu, but you can also store and load those values from a database, based on the code I&#039;m going to provide:</p>
<p><span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">name</span>=<span class="st0">&#034;form1&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/select.html"><span class="kw2">&lt;select</span></a> <span class="kw3">name</span>=<span class="st0">&#034;types&#034;</span> <span class="kw3">onChange</span>=<span class="st0">&#034;fillItems(0)&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/option.html"><span class="kw2">&lt;option</span></a> <span class="kw3">value</span>=<span class="st0">&#034;32&#034;</span><span class="kw2">&gt;</span></a></span>Laptops<span class="sc2"><span class="kw2">&lt;/option&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/option.html"><span class="kw2">&lt;option</span></a> <span class="kw3">value</span>=<span class="st0">&#034;21&#034;</span><span class="kw2">&gt;</span></a></span>PDAs<span class="sc2"><span class="kw2">&lt;/option&gt;</span></span><br />
&nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/select&gt;</span></span><br />
&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/select.html"><span class="kw2">&lt;select</span></a> <span class="kw3">name</span>=<span class="st0">&#034;items&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;/select&gt;</span></span><br />
<span class="sc2"><span class="kw2">&lt;/form&gt;</span></span></p>
<p>Here&#039;s the ASP code to build the array of possible menu items:</p>
<p><span class="kw2">&lt;script language=</span><span class="st0">&#034;JavaScript&#034;</span>&gt;<br />
<span class="kw2">var</span> arItems = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#040;</span><span class="br0">&#041;</span><br />
arItems = <span class="br0">&#091;</span><br />
<span class="kw2">&lt;%</span><br />
&nbsp; &nbsp; strSQL = <span class="st0">&#034;SELECT type_id, id, description FROM items&#034;</span><br />
&nbsp; &nbsp; objRS.<span class="kw3">Open</span> strSQL, strConn<br />
&nbsp; &nbsp; &nbsp; &nbsp;arItems = objRS.<span class="me1">GetRows</span><span class="br0">&#040;</span><span class="br0">&#041;</span><br />
&nbsp; &nbsp; objRS.<span class="kw3">Close</span><span class="br0">&#040;</span><span class="br0">&#041;</span></p>
<p>&nbsp; &nbsp; <span class="kw1">for</span> i = <span class="nu0">0</span> <span class="kw1">to</span> <span class="kw3">uBound</span><span class="br0">&#040;</span> atItems, <span class="nu0">2</span> <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">response</span>.<span class="kw3">Write</span><span class="br0">&#040;</span> <span class="st0">&#034;["</span> &amp; atItems<span class="br0">&#040;</span> <span class="nu0">0</span>, i <span class="br0">&#041;</span> &amp; <span class="st0">","</span> &amp; atItems<span class="br0">&#040;</span> <span class="nu0">1</span>, i <span class="br0">&#041;</span> &amp; <span class="st0">",'"</span> &amp; atItems<span class="br0">&#040;</span> <span class="nu0">2</span>, i <span class="br0">&#041;</span> &amp; <span class="st0">"']&#034;</span> <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> i &lt; <span class="kw3">uBound</span><span class="br0">&#040;</span> atItems, <span class="nu0">2</span> <span class="br0">&#041;</span> <span class="kw1">then</span> <span class="kw1">response</span>.<span class="kw3">Write</span><span class="br0">&#040;</span><span class="st0">&#034;,&#034;</span> &amp; vbCrLf <span class="br0">&#041;</span><br />
&nbsp; &nbsp; <span class="kw1">next</span><br />
<span class="kw2">%&gt;</span><br />
<span class="br0">&#093;</span></p>
<p>Here&#039;s the PHP code to build the array of possible menu items:</p>
<p><span class="kw2">var</span> arItems = <span class="kw2">new</span> <a href="http://www.php.net/array"><span class="kw3">Array</span></a><span class="br0">&#040;</span><span class="br0">&#041;</span><br />
arItems = <span class="br0">&#091;</span><br />
<span class="kw2">&lt;?php</span><br />
<span class="kw1">include_once</span><span class="br0">&#040;</span><span class="st0">&#034;connection.php&#034;</span><span class="br0">&#041;</span>;<br />
<span class="re0">$query</span> = <span class="st0">&#034;SELECT type_id, id, description FROM items&#034;</span>;<br />
<span class="re0">$result</span> = <a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#040;</span><span class="re0">$query</span><span class="br0">&#041;</span>;<br />
<span class="re0">$num_rows</span> = <a href="http://www.php.net/mysql_num_rows"><span class="kw3">mysql_num_rows</span></a><span class="br0">&#040;</span> <span class="re0">$result</span> <span class="br0">&#041;</span>;<br />
<span class="re0">$i</span> = <span class="nu0">1</span>;<br />
<span class="kw1">while</span> <span class="br0">&#040;</span><span class="re0">$row_result</span> = <a href="http://www.php.net/mysql_fetch_row"><span class="kw3">mysql_fetch_row</span></a><span class="br0">&#040;</span><span class="re0">$result</span><span class="br0">&#041;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#034;['"</span>.<span class="re0">$row_result</span><span class="br0">&#091;</span><span class="nu0">0</span><span class="br0">&#093;</span>.<span class="st0">"', '"</span>.<span class="re0">$row_result</span><span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span>.<span class="st0">"', '"</span>.<span class="re0">$row_result</span><span class="br0">&#091;</span><span class="nu0">2</span><span class="br0">&#093;</span>.<span class="st0">"']&#034;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> <span class="re0">$i</span> &lt; <span class="re0">$num_rows</span> <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#034;, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &#034;</span>;<br />
&nbsp; &nbsp; <span class="re0">$i</span>++;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">?&gt;</span><br />
<span class="br0">&#093;</span></p>
<p>This will produce a JavaScript array that looks like this:</p>
<p>arItems = <span class="br0">&#091;</span><br />
&nbsp; &nbsp; <span class="br0">&#091;</span> <span class="nu0">32</span>, <span class="nu0">234</span>, <span class="st0">&#039;Toshiba Laptops&#039;</span><span class="br0">&#093;</span>,<br />
&nbsp; &nbsp; <span class="br0">&#091;</span> <span class="nu0">32</span>, <span class="nu0">156</span>, <span class="st0">&#039;Compaq Laptops&#039;</span><span class="br0">&#093;</span>,<br />
&nbsp; &nbsp; <span class="br0">&#091;</span> <span class="nu0">32</span>, <span class="nu0">333</span>, <span class="st0">&#039;Sony Laptops&#039;</span><span class="br0">&#093;</span>,<br />
&nbsp; &nbsp; <span class="br0">&#091;</span> <span class="nu0">21</span>, <span class="nu0">656</span>, <span class="st0">&#039;IBM PDAs&#039;</span><span class="br0">&#093;</span>,<br />
&nbsp; &nbsp; <span class="br0">&#091;</span> <span class="nu0">21</span>, <span class="nu0">467</span>, <span class="st0">&#039;Palm PDAs&#039;</span><span class="br0">&#093;</span><br />
<span class="br0">&#093;</span></p>
<p>And finally, here&#039;s the JavaScript function used to populate the second menu:</p>
<p><span class="kw2">function</span> fillItems<span class="br0">&#040;</span>intStart<span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> fTypes = document.<span class="me1">form1</span>.<span class="me1">types</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> fItems = document.<span class="me1">form1</span>.<span class="me1">items</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> a = arItems;<br />
&nbsp; &nbsp; <span class="kw2">var</span> b, c, d, intItem, intType</p>
<p>&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> intStart &gt; <span class="nu0">0</span> <span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#040;</span> b = <span class="nu0">0</span>; b &lt; a.<span class="me1">length</span>; b++ <span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> a<span class="br0">&#091;</span>b<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span> == intStart <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; intType = a<span class="br0">&#091;</span>b<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span><span class="br0">&#093;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#040;</span> c = <span class="nu0">0</span>; c &lt; fTypes.<span class="me1">length</span>; c++ <span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> fTypes.<span class="me1">options</span><span class="br0">&#091;</span> c <span class="br0">&#093;</span>.<span class="me1">value</span> == intType <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fTypes.<span class="me1">selectedIndex</span> = c;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> intType == <span class="kw2">null</span> <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; intType = fTypes.<span class="me1">options</span><span class="br0">&#091;</span> fTypes.<span class="me1">selectedIndex</span> <span class="br0">&#093;</span>.<span class="me1">value</span>;</p>
<p>&nbsp; &nbsp; fItems.<span class="me1">options</span>.<span class="me1">length</span> = <span class="nu0">0</span>;</p>
<p>&nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#040;</span> d = <span class="nu0">0</span>; d &lt; a.<span class="me1">length</span>; d++ <span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> a<span class="br0">&#091;</span>d<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span><span class="br0">&#093;</span> == intType <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fItems.<span class="me1">options</span><span class="br0">&#091;</span> fItems.<span class="me1">options</span>.<span class="me1">length</span> <span class="br0">&#093;</span> = <span class="kw2">new</span> Option<span class="br0">&#040;</span> a<span class="br0">&#091;</span>d<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">2</span><span class="br0">&#093;</span>, a<span class="br0">&#091;</span>d<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span> <span class="br0">&#041;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span> a<span class="br0">&#091;</span>d<span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span> == intStart <span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fItems.<span class="me1">selectedIndex</span> = fItems.<span class="me1">options</span>.<span class="me1">length</span> &#8211; <span class="nu0">1</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/150-dynamically-populating-select-menus-client-side-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Build a Dynamic Picture Viewer</title>
		<link>http://www.doyourself.org/javascript/151-php-build-a-dynamic-picture-viewer/</link>
		<comments>http://www.doyourself.org/javascript/151-php-build-a-dynamic-picture-viewer/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[a]]></category>
		<category><![CDATA[Build]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Picture]]></category>
		<category><![CDATA[Viewer]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=151</guid>
		<description><![CDATA[Display all pictures in a directory without having to keep track of or input file names. This PHP script retrieves a list of all images inside the directory and passes them in an array to be displayed. The menu to choose the image to display is also automatically generated. In IE and Firefox the images [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Display all pictures in a directory without having to keep track of or input file names. This PHP script retrieves a list of all images inside the directory and passes them in an array to be displayed. The menu to choose the image to display is also automatically generated. In IE and Firefox the images will fade in.<span></span></p>
<p>Save this PHP code as getpics.php. It should be in the directory with the images, but you can configure it otherwise</p>
<p><span class="kw2">&lt;?</span><br />
<a href="http://www.php.net/header"><span class="kw3">Header</span></a><span class="br0">&#040;</span><span class="st0">&#034;content-type: application/x-javascript&#034;</span><span class="br0">&#041;</span>;<br />
<span class="re0">$pathstring</span>=<a href="http://www.php.net/pathinfo"><span class="kw3">pathinfo</span></a><span class="br0">&#040;</span><span class="re0">$_SERVER</span><span class="br0">&#091;</span><span class="st0">&#039;PHP_SELF&#039;</span><span class="br0">&#093;</span><span class="br0">&#041;</span>;<br />
<span class="re0">$locationstring</span>=<span class="st0">&#034;http://&#034;</span> . <span class="re0">$_SERVER</span><span class="br0">&#091;</span><span class="st0">&#039;HTTP_HOST&#039;</span><span class="br0">&#093;</span>.<span class="re0">$pathstring</span><span class="br0">&#091;</span><span class="st0">&#039;dirname&#039;</span><span class="br0">&#093;</span> . <span class="st0">&#034;/&#034;</span>;</p>
<p><span class="kw2">function</span> returnimages<span class="br0">&#040;</span><span class="re0">$dirname</span>=<span class="st0">&#034;.&#034;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="re0">$pattern</span>=<span class="st0">&#034;(<span class="es0">.</span>jpg$)|(<span class="es0">.</span>png$)|(<span class="es0">.</span>jpeg$)|(<span class="es0">.</span>gif$)&#034;</span>;<br />
&nbsp; &nbsp;<span class="re0">$files</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#040;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="re0">$curimage</span>=<span class="nu0">0</span>;<br />
&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#040;</span><span class="re0">$handle</span> = <a href="http://www.php.net/opendir"><span class="kw3">opendir</span></a><span class="br0">&#040;</span><span class="re0">$dirname</span><span class="br0">&#041;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">while</span><span class="br0">&#040;</span><span class="kw2">false</span> !== <span class="br0">&#040;</span><span class="re0">$file</span> = <a href="http://www.php.net/readdir"><span class="kw3">readdir</span></a><span class="br0">&#040;</span><span class="re0">$handle</span><span class="br0">&#041;</span><span class="br0">&#041;</span><span class="br0">&#041;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#040;</span><a href="http://www.php.net/eregi"><span class="kw3">eregi</span></a><span class="br0">&#040;</span><span class="re0">$pattern</span>, <span class="re0">$file</span><span class="br0">&#041;</span><span class="br0">&#041;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;picsarray['</span> . <span class="re0">$curimage</span> .<span class="st0">']=&quot;&#039;</span> . <span class="re0">$file</span> . <span class="st0">&#039;&quot;;&#039;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">$curimage</span>++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.php.net/closedir"><span class="kw3">closedir</span></a><span class="br0">&#040;</span><span class="re0">$handle</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="kw1">return</span><span class="br0">&#040;</span><span class="re0">$files</span><span class="br0">&#041;</span>;<br />
<span class="br0">&#125;</span></p>
<p><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;var locationstring=&quot;&#039;</span> . <span class="re0">$locationstring</span> . <span class="st0">&#039;&quot;;&#039;</span>;<br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#039;var picsarray=new Array();&#039;</span>;<br />
returnimages<span class="br0">&#040;</span><span class="br0">&#041;</span><br />
<span class="kw2">?&gt;</span></p></blockquote>
<p>And here&#039;s the HTML page to view the images. You can stylize it however you&#039;d like.</p>
<p><span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span class="sc2"><a href="http://december.com/html/4/element/html.html"><span class="kw2">&lt;html</span></a> xmlns=<span class="st0">&#034;http://www.w3.org/1999/xhtml&#034;</span><span class="kw2">&gt;</span></a></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/head.html"><span class="kw2">&lt;head&gt;</span></a></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/meta.html"><span class="kw2">&lt;meta</span></a> <span class="kw3">http-equiv</span>=<span class="st0">&#034;Content-Type&#034;</span> <span class="kw3">content</span>=<span class="st0">&#034;text/html; charset=iso-8859-1&#034;</span> /<span class="kw2">&gt;</span></a></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/title.html"><span class="kw2">&lt;title&gt;</span></a></span>Show all images<span class="sc2"><span class="kw2">&lt;/title&gt;</span></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/style.html"><span class="kw2">&lt;style</span></a> <span class="kw3">type</span>=<span class="st0">&#034;text/css&#034;</span><span class="kw2">&gt;</span></a></span><br />
#picturearea{<br />
&nbsp; &nbsp; &nbsp; &nbsp; filter:alpha(opacity=100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; -moz-opacity: 0;<br />
}<br />
<span class="sc2"><span class="kw2">&lt;/style&gt;</span></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/script.html"><span class="kw2">&lt;script</span></a> <span class="kw3">src</span>=<span class="st0">&#034;getpics.php&#034;</span> <span class="kw3">type</span>=<span class="st0">&#034;text/javascript&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;/script&gt;</span></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/script.html"><span class="kw2">&lt;script</span></a> <span class="kw3">type</span>=<span class="st0">&#034;text/javascript&#034;</span><span class="kw2">&gt;</span></a></span><br />
function populateSelect(selectobj)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (var i=0; i<span class="sc2">&lt;picsarray.length; i++<span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectobj.options<span class="br0">&#091;</span>selectobj.options.length<span class="br0">&#093;</span>=new Option<span class="br0">&#040;</span>picsarray<span class="br0">&#091;</span>i<span class="br0">&#093;</span>, picsarray<span class="br0">&#091;</span>i<span class="br0">&#093;</span><span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; if <span class="br0">&#040;</span>selectobj.options.length&gt;</span>1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectobj.selectedIndex=0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showpicture(document.getElementById(&quot;picsform&quot;).picslist)<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
function showpicture(selectobj)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj=document.getElementById(&quot;picturearea&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; resetfade(10)<br />
&nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj.innerHTML=&#039;<span class="sc2"><a href="http://december.com/html/4/element/img.html"><span class="kw2">&lt;img</span></a> <span class="kw3">src</span>=<span class="st0">&#034;&#039;+locationstring+selectobj.options[selectobj.selectedIndex].value+&#039;&#034;</span><span class="kw2">&gt;</span></a></span>&#039;<br />
&nbsp; &nbsp; &nbsp; &nbsp; fadepictoview=setInterval(&quot;gradualfade(piccontainerobj)&quot;,50)<br />
}<br />
function resetfade(degree)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (window.fadepictoview)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clearInterval(fadepictoview)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (typeof piccontainerobj.style.MozOpacity==&quot;string&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj.style.MozOpacity=degree/100<br />
&nbsp; &nbsp; &nbsp; &nbsp; else if (piccontainerobj.filters)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj.filters.alpha.opacity=degree<br />
}<br />
function gradualfade()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (typeof piccontainerobj.style.MozOpacity==&quot;string&quot; <span class="sc1">&amp;&amp; piccontainerobj.style.MozOpacity&lt;1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj.style.MozOpacity=Math.min(parseFloat(piccontainerobj.style.MozOpacity)+0.2, 0.99)<br />
&nbsp; &nbsp; &nbsp; &nbsp; else if (piccontainerobj.filters &amp;&amp; piccontainerobj.filters.alpha.opacity&lt;100)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; piccontainerobj.filters.alpha.opacity+=20<br />
&nbsp; &nbsp; &nbsp; &nbsp; else //if not IE or Moz<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clearInterval(fadepictoview)<br />
}<br />
window.onload=function()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; populateSelect(document.getElementById(&quot;picsform&quot;).picslist)<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div style=&quot;float: left;</span> width: 200px;&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">id</span>=<span class="st0">&#034;picsform&#034;</span><span class="kw2">&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/select.html"><span class="kw2">&lt;select</span></a> <span class="kw3">name</span>=<span class="st0">&#034;picslist&#034;</span> <span class="kw3">size</span>=<span class="st0">&#034;4&#034;</span> <span class="kw3">style</span>=<span class="st0">&#034;width: 200px&#034;</span> <span class="kw3">onClick</span>=<span class="st0">&#034;showpicture(this)&#034;</span><span class="kw2">&gt;</span></a></span><span class="sc2"><span class="kw2">&lt;/select&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/form&gt;</span></span><br />
<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span><br />
<span class="sc2"><a href="http://december.com/html/4/element/div.html"><span class="kw2">&lt;div</span></a> <span class="kw3">id</span>=<span class="st0">&#034;picturearea&#034;</span> <span class="kw3">style</span>=<span class="st0">&#034;float: left; width: 400px; height: 300px; margin-left: 20px&#034;</span><span class="kw2">&gt;</span></a></span><br />
<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span><br />
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span><br />
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/151-php-build-a-dynamic-picture-viewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build an image slideshow with PHP &amp; JavaScript</title>
		<link>http://www.doyourself.org/javascript/115-build-an-image-slideshow-with-php-javascript/</link>
		<comments>http://www.doyourself.org/javascript/115-build-an-image-slideshow-with-php-javascript/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[&]]></category>
		<category><![CDATA[an]]></category>
		<category><![CDATA[Build]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=115</guid>
		<description><![CDATA[There are numerous scripts out there that use PHP to scan the contents of a particular directory, and create a &#034;gallery&#034; of sorts from all of the images in the folder. There are also JavaScripts out there that allow you to rotate between images in a gallery without refreshing the page &#8211; thus creating a [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>There are numerous scripts out there that use PHP to scan the contents of a particular directory, and create a &#034;gallery&#034; of sorts from all of the images in the folder. There are also JavaScripts out there that allow you to rotate between images in a gallery without refreshing the page &#8211; thus creating a slideshow on the page. Well, without having to know too much PHP or JavaScript, you can now have both of those capabilities in one easy to configure PHP class!<span></span></p>
<p><a href="http://www.phpclasses.org/browse/package/4167.html">This open source PHP class</a> is used to present images in a slide show without reloading the current page. It automatically generates the necessary HTML and Javascript to display the listing of images, on the page. Best of all, the images are scanned from a list of files in a server side directory, which means that you can just upload a new image and it will be there!</p>
<p>You can also easily configure the delay time between switching the images on the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/115-build-an-image-slideshow-with-php-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A very fast way to validate a form with JavaScript</title>
		<link>http://www.doyourself.org/javascript/116-a-very-fast-way-to-validate-a-form-with-javascript/</link>
		<comments>http://www.doyourself.org/javascript/116-a-very-fast-way-to-validate-a-form-with-javascript/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[a]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[very]]></category>
		<category><![CDATA[way]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=116</guid>
		<description><![CDATA[There are many universal form validation functions out there. But I created this very quick function to very easily check for input, without modifying your form fields in any way, and without have to check each field individually. The script just checks for a value, it doesn&#039;t validate the format (like an email address), because [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>There are many universal form validation functions out there. But I created this very quick function to very easily check for input, without modifying your form fields in any way, and without have to check each field individually. The script just checks for a value, it doesn&#039;t validate the format (like an email address), because that&#039;s very easy to add, so you can do it yourself!</p>
<p>All you do is put the name of each field in the array, and it quickly loops through the array, checks the field, and fails if one of the fields is empty</p>
<p><span class="kw2">function</span> checkForm<span class="br0">&#040;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; f = document.<span class="me1">form1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> isGood = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> required = <span class="kw2">new</span> Array<span class="br0">&#040;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; required<span class="br0">&#091;</span><span class="nu0">0</span><span class="br0">&#093;</span> = <span class="st0">&#034;email&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; required<span class="br0">&#091;</span><span class="nu0">1</span><span class="br0">&#093;</span> = <span class="st0">&#034;password&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; required<span class="br0">&#091;</span><span class="nu0">2</span><span class="br0">&#093;</span> = <span class="st0">&#034;first_name&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; required<span class="br0">&#091;</span><span class="nu0">2</span><span class="br0">&#093;</span> = <span class="st0">&#034;last_name&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; required<span class="br0">&#091;</span><span class="nu0">3</span><span class="br0">&#093;</span> = <span class="st0">&#034;country&#034;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#040;</span>i <span class="kw1">in</span> required<span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#040;</span>f.<span class="me1">elements</span><span class="br0">&#091;</span>i<span class="br0">&#093;</span>.<span class="me1">value</span>==<span class="st0">&#034;&#034;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isGood = <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#040;</span>!isGood<span class="br0">&#041;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">alert</span><span class="br0">&#040;</span><span class="st0">&#034;Please fill in all of the required fields.&#034;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> isGood;<br />
<span class="br0">&#125;</span><br />
<span class="co1">//&#8211;&gt;</span><br />
&lt;/script&gt;</p>
<p>Then put this in your form code:</p>
<p><span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">name</span>=<span class="st0">&#034;form1&#034;</span> <span class="kw3">method</span>=<span class="st0">&#034;post&#034;</span> <span class="kw3">action</span>=<span class="st0">&#034;&#034;</span> <span class="kw3">onSubmit</span>=<span class="st0">&#034;return checkForm();&#034;</span><span class="kw2">&gt;</span></a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/116-a-very-fast-way-to-validate-a-form-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check IP format with Regular Expressions in JavaScript</title>
		<link>http://www.doyourself.org/javascript/117-check-ip-format-with-regular-expressions-in-javascript/</link>
		<comments>http://www.doyourself.org/javascript/117-check-ip-format-with-regular-expressions-in-javascript/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Check]]></category>
		<category><![CDATA[Expressions]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[in]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[Regular]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=117</guid>
		<description><![CDATA[Here&#039;s a quick JavaScript function to check that a user has entered a valid IP address. Don&#039;t ask me why, but there may be times when you need a user to input an IP address, rather than just grab theirs. And it&#039;s always easier to check first on the client side with JavaScript than having [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Here&#039;s a quick JavaScript function to check that a user has entered a valid IP address. Don&#039;t ask me why, but there may be times when you need a user to input an IP address, rather than just grab theirs. And it&#039;s always easier to check first on the client side with JavaScript than having to do all the validation on the post back to the server with PHP!</p>
<p><span class="kw2">var</span> filter = <span class="re0">/^<span class="br0">&#040;</span><span class="br0">&#091;</span><span class="nu0">1</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#123;</span><span class="nu0">0</span>,<span class="nu0">2</span><span class="br0">&#125;</span><span class="br0">&#041;</span>+.<span class="br0">&#040;</span><span class="br0">&#091;</span><span class="nu0">1</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#123;</span><span class="nu0">0</span>,<span class="nu0">2</span><span class="br0">&#125;</span><span class="br0">&#041;</span>+.<span class="br0">&#040;</span><span class="br0">&#091;</span><span class="nu0">1</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#123;</span><span class="nu0">0</span>,<span class="nu0">2</span><span class="br0">&#125;</span><span class="br0">&#041;</span>+.<span class="br0">&#040;</span><span class="br0">&#091;</span><span class="nu0">1</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#091;</span><span class="nu0">0</span>-<span class="nu0">9</span><span class="br0">&#093;</span><span class="br0">&#123;</span><span class="nu0">0</span>,<span class="nu0">2</span><span class="br0">&#125;</span><span class="br0">&#041;</span>+$/</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="kw1">if</span> <span class="br0">&#040;</span>!filter.<span class="me1">test</span><span class="br0">&#040;</span>f.<span class="me1">ip</span>.<span class="me1">value</span><span class="br0">&#041;</span><span class="br0">&#041;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">alert</span><span class="br0">&#040;</span><span class="st0">&#039;Please enter a valid IP&#039;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.<span class="me1">ip</span>.<span class="kw3">focus</span><span class="br0">&#040;</span><span class="br0">&#041;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">false</span><br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/117-check-ip-format-with-regular-expressions-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps causes Internet Explorer to crash</title>
		<link>http://www.doyourself.org/javascript/118-google-maps-causes-internet-explorer-to-crash/</link>
		<comments>http://www.doyourself.org/javascript/118-google-maps-causes-internet-explorer-to-crash/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 10:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[causes]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[Explorer]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/?p=118</guid>
		<description><![CDATA[I was working on a site the other day, and I came across the error on a page that I&#039;ve never seen before. The page had an embedded Google Map, and there was a JavaScript function to display the map. The page worked in FireFox, but when I ran it in IE, I got the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I was working on a site the other day, and I came across the error on a page that I&#039;ve never seen before. The page had an embedded Google Map, and there was a JavaScript function to display the map. The page worked in FireFox, but when I ran it in IE, I got the following JavaScript error:</p>
<blockquote><p>Internet Explorer could not open the internet site.<br />
Operation aborted.</p>
</blockquote>
<p>And not one bit of the page would display.</p>
<p>I dug around online, but couldn&#039;t find anything. On a complete whim, I decided to try to move the showMap() function into the window.onload() handler. And crazily enough, it worked! So the whole error was caused by the showMap() being run before the page had fully loaded. Insane&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/javascript/118-google-maps-causes-internet-explorer-to-crash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

