<?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>Ogremindes.net &#187; javascript</title>
	<atom:link href="http://ogremindes.net/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ogremindes.net</link>
	<description></description>
	<lastBuildDate>Thu, 18 Feb 2010 21:41:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Link Cleanup</title>
		<link>http://ogremindes.net/blog/link-cleanup/</link>
		<comments>http://ogremindes.net/blog/link-cleanup/#comments</comments>
		<pubDate>Fri, 29 Sep 2006 07:25:32 +0000</pubDate>
		<dc:creator>Ogremindes</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gabbly]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://ogremindes.net/link-cleanup/</guid>
		<description><![CDATA[I&#8217;m starting to get a mess of links on my desktop. They&#8217;re all interesting, so I&#8217;ll whack &#8216;em up here.

Five simple steps to better typography...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to get a mess of links on my desktop. They&#8217;re all interesting, so I&#8217;ll whack &#8216;em up here.</p>
<ul>
<li><a href="http://www.markboulton.co.uk/journal/comments/five_simple_steps_to_better_typography/" onclick="javascript:urchinTracker ('/outbound/article/www.markboulton.co.uk');">Five simple steps to better typography</a>. Covers such things as line length and word spacing.</li>
<li><a href="http://www.dgx.cz/trine/item/how-to-avoid-activation-of-active-x-in-ie" onclick="javascript:urchinTracker ('/outbound/article/www.dgx.cz');">How to avoid activation of Active-X in IE</a>. Due to recent changes, flash (and other things) have to be clicked before they work in IE. This is a workaround.</li>
<li><a href="http://www.dgx.cz/trine/item/how-to-correctly-insert-a-flash-into-xhtml" onclick="javascript:urchinTracker ('/outbound/article/www.dgx.cz');">How to correctly insert a Flash into XHTML</a>. A functional, valid way of inserting flash into a web page.</li>
<li><a href="http://www.digital-web.com/articles/architecting_css/" onclick="javascript:urchinTracker ('/outbound/article/www.digital-web.com');">Architecting CSS</a>. Techniques for organising CSS.</li>
<li><a href="http://home.gabbly.com/" onclick="javascript:urchinTracker ('/outbound/article/home.gabbly.com');">Gabbly</a>. An interesting way to get chat on a website.</li>
</ul>
<p>And a <a href="http://www.gocomics.com/foxtrot/2006/09/19/" onclick="javascript:urchinTracker ('/outbound/article/www.gocomics.com');">comic</a>, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://ogremindes.net/blog/link-cleanup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction To Programming: Object Orientated Programming Principles</title>
		<link>http://ogremindes.net/blog/introduction-to-programming-object-orientated-programming-principles/</link>
		<comments>http://ogremindes.net/blog/introduction-to-programming-object-orientated-programming-principles/#comments</comments>
		<pubDate>Tue, 30 May 2006 01:37:58 +0000</pubDate>
		<dc:creator>Ogremindes</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[TAFE]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[oop]]></category>

		<guid isPermaLink="false">http://ogremindes.net/introduction-to-programming-object-orientated-programming-principles/</guid>
		<description><![CDATA[Although I didn&#8217;t know it at the time, my first exposure to OOP was with TADS, a language for developing text-based adventure games...]]></description>
			<content:encoded><![CDATA[<p>Although I didn&#8217;t know it at the time, my first exposure to <acronym title="Object Orientated Programming">OOP</acronym> was with <acronym title="Text Adventure Development System"><a href="http://www.tads.org/" onclick="javascript:urchinTracker ('/outbound/article/www.tads.org');">TADS</a></acronym>, a language for developing text-based adventure games. I didn&#8217;t stick with <acronym title="Text Adventure Development System"><a href="http://www.tads.org/" onclick="javascript:urchinTracker ('/outbound/article/www.tads.org');">TADS</a></acronym> for very long, just for a few weeks between finishing year 12 and getting a copy of <a href="http://www.blizzard.com/diablo2/" onclick="javascript:urchinTracker ('/outbound/article/www.blizzard.com');">Diablo II</a></p>
<p>Object Orientated Programming (<acronym title="Object Orientated Programming">OOP</acronym>) is programming by referring to, well, <em>things</em>.</p>
<p>In regular(linear) programming everything that the program does is laid out by the programmer. In <acronym title="Object Orientated Programming">OOP</acronym>, we have use of <em>objects</em>: self-contained collections of data and instructions.</p>
<p>So, while in linear programming if we wanted to know the length of a string we&#8217;d have to construct a loop to count through each of the letters, in <acronym title="Object Orientated Programming">OOP</acronym> we could call up the &#8216;length&#8217; property of the already-defined string object. The code for counting the letters still exists, but it is inside the string object and the programmer never needs to know how it gets the number. All the programmer needs to know is an what properties an object has, and what it can do: its methods.</p>
<h3>What are Properties and Methods? What&#8217;s the difference?</h3>
<p>The properties of an object are information about it: the colour of a paint or the date of a diary entry would be considered properties of those things. Conversely methods are the things that an object can do: a car can accelerate, an alarm bell can ring.</p>
<p>Let us take, for the purpose of example, a printer:<br />
<img src="http://ogremindes.net/wp-content/uploads/2006/05/lexmark-e321-laser-printer.thumbnail.jpg" alt="lexmark-e321-laser-printer.jpg"></p>
<ul>
<li>
<h4>Properties</h4>
</li>
<li>Paper Left</li>
<li>Ready Status</li>
<li>Power Status (on/off)</li>
<li>Ink Level</li>
</ul>
<ul>
<li>
<h4>Methods</h4>
</li>
<li>Print Single Sided</li>
<li>Print Double Sided</li>
</ul>
<h3>The Dot Syntax</h3>
<p>In many object orientated programming languages the <em>dot syntax</em> is used for referring to objects and their properties and methods. To take the example above, the syntax to refer to the &#8216;Paper Left&#8217; property would be <code>printer.paperLeft</code>. The syntax for telling it to print a document single-sided would be <code>printer.printSingleSided(myDocument)</code>, where myDocument is the document to be printed. Methods always have a pair of brackets at the end, if the method needs information to work then that information is but inside the brackets.</p>
<h3>JavaScript Objects</h3>
<p>JavaScript is an object orientated language, with its own collection of objects. It also uses the <acronym title="Document Object Model">DOM</acronym> to access objects within HTML files.</p>
<p>The variable is one of the most common JavaScript objects. For a variable containing a string called <var>myString</var>, containing the word &#8220;script&#8221; there would be properties such as <code>myString.value</code>, which would be &#8220;script&#8221;, and <code>myString.length</code>, which would be 6. Methods for myString would include <code>toUpperCase()</code>, which converts the letters all to uppercase, and <code>indexOf()</code>, which would give the position of a given letter in the string.</p>
<p>The &#8220;text&#8221; object corresponds to a HTML <code></code>. Properties include <code>disabled</code>, which will either be true, in which case the input is disabled, or false, where the input can be activated, and <code>defaultValue</code>, which is the default text in the input. Methods include <code>focus()</code>, which puts the curser in the input, and <code>blur()</code>, which removes the curser from the input.</p>
<p>The &#8220;image&#8221; object corresponds to a HTML <code>&lt;img /&gt;</code> element. Properties include &#8220;src&#8221;, the source file of the image, &#8220;width&#8221; and &#8220;hight&#8221;. Methods include <code>click()</code>, which has the effect of clicking on the image (for the purposes of an <code>onClick()</code> event, for example).</p>
]]></content:encoded>
			<wfw:commentRss>http://ogremindes.net/blog/introduction-to-programming-object-orientated-programming-principles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Bluff Your Way in Javascript! SXSW Podcast</title>
		<link>http://ogremindes.net/blog/how-to-bluff-your-way-in-javascript-sxsw-podcast/</link>
		<comments>http://ogremindes.net/blog/how-to-bluff-your-way-in-javascript-sxsw-podcast/#comments</comments>
		<pubDate>Mon, 24 Apr 2006 01:36:06 +0000</pubDate>
		<dc:creator>Ogremindes</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[podcasts]]></category>
		<category><![CDATA[sxsw]]></category>

		<guid isPermaLink="false">http://ogremindes.net/how-to-bluff-your-way-in-javascript-sxsw-podcast/</guid>
		<description><![CDATA[How to Bluff Your Way in DOM Scripting was the title of the video Michael failed to show us before, due to TAFE network restrictions...]]></description>
			<content:encoded><![CDATA[<p><img src="http://ogremindes.net/wp-content/uploads/2006/04/icon_podcast_128x128.png" alt="podcast icon" />
<p>How to Bluff Your Way in DOM Scripting was the title of the video Michael failed to show us before, due to TAFE network restrictions.</p>
<p>Now the mp3 of the full hour-long &#8216;interactive panel&#8217; is available for download. This covers javascript at about our level and a bit above.</p>
<ul>
<li><a href="http://2006.sxsw.com/coverage/podcasts/" onclick="javascript:urchinTracker ('/outbound/article/2006.sxsw.com');">SXSW Podcasts</a></li>
<li><a href="http://server1.sxsw.com/2006/coverage/SXSW06.INT.20060311.BluffYourWayinDOMScripting.mp3" onclick="javascript:urchinTracker ('/outbound/article/server1.sxsw.com');">How to Bluff Your Way in DOM Scripting (mp3 27MB)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ogremindes.net/blog/how-to-bluff-your-way-in-javascript-sxsw-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://server1.sxsw.com/2006/coverage/SXSW06.INT.20060311.BluffYourWayinDOMScripting.mp3" length="28045667" type="audio/mpeg" />
		</item>
		<item>
		<title>The Quest for a Better Category List &#8211; Part the First: A Basic CSS/JavaScript Popup Menu</title>
		<link>http://ogremindes.net/blog/the-quest-for-a-better-category-list-part-the-first-a-basic-cssjavascript-popup-menu/</link>
		<comments>http://ogremindes.net/blog/the-quest-for-a-better-category-list-part-the-first-a-basic-cssjavascript-popup-menu/#comments</comments>
		<pubDate>Fri, 24 Mar 2006 04:15:11 +0000</pubDate>
		<dc:creator>Ogremindes</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://ogremindes.net/the-quest-for-a-better-category-list-part-the-first-a-basic-cssjavascript-popup-menu/</guid>
		<description><![CDATA[One of the reasons I switched from Blogger to WordPress is wp&#8217;s category system, which would allow far easier access to anything of intrest I post...]]></description>
			<content:encoded><![CDATA[<p>One of the reasons I switched from <a href="http://www.blogger.com/" onclick="javascript:urchinTracker ('/outbound/article/www.blogger.com');">Blogger</a> to WordPress is wp&#8217;s category system, which would allow far easier access to anything of intrest I post. The category list is nice and all, and with a little tweaking displays in a nice hierarchal view.</p>
<p>However, a after a bit of thought I realised with my resolve to put everything in &#8216;child&#8217; categories, the number of categories could rapidly rise. With that, the category list would become behemothian and as such all but useless. What I need is a way to restrict the categories shown, so that the user would only see what information they needed at the time.</p>
<p><span id="more-24"></span></p>
<h4>Popup Lists</h4>
<p>The Popup List technique allows for lists that display only when the &#8216;parent&#8217; element is hovered over. In this example the parent shall be a <code>&lt;li&gt;&lt;/li&gt;</code> in another list that is id&#8217;d as &#8216;list&#8217;. The popup list will remain visible so long as the curser is over it, or it&#8217;s parent.</p>
</p>
<p>By default, the popup list will be absolutely positioned way off the screen, for, as we know, if it was set to <code>display:none</code> or <code>visibilty: hidden</code> the popup list mightn&#8217;t be read by screenreaders. Then again, maybe that would be preferable.</p>
<p>When the parent <code>&lt;li&gt;&lt;/li&gt;</code> is hovered over, the popup list&#8217;s position will be set to static, bringing it to it&#8217;s normal position in the document, shuffling other things out of the way to fit. The CSS is:</p>
<pre><code>#list li ul {
  position: absolute;
  left: -5000px;
}
#list li:hover &amp;gt; ul {
  position: static;
}</code></pre>
</p>
<p>The first rule states that a unordered list inside a list item inside the container &#8216;list&#8217; should be positioned well away from the window. The second rule states that when a list item inside &#8216;list&#8217; is hovered then an unordered list that is the direct child of said list item should be positioned normally, as opposed to absolutely, for example. These two together achieve the desired effect.</p>
<p><a href="http://ogremindes.net/wp-content/uploads/2006/03/cssdemo.html" > An example of the code in action.</a></p>
<p>There is a catch, however. Internet Explorer 6 doesn&#8217;t recognise :hover on anything but an <code>&lt;a&gt;&lt;/a&gt;</code>, nor does it recognise any of the more contorted CSS selectors that would make it otherwise possible to use this technique. What to do, what to do&#8230;  Ah-ha! JavaScript.</p>
<h4>Add a little JavaScript</h4>
<p>The JavaScript <code>getElementById()</code> method returns the HTML element of the ID given. I want to modify a HTML element â€” the child ul. As such, I examined the <a href="http://www.w3schools.com/htmldom/dom_reference.asp" onclick="javascript:urchinTracker ('/outbound/article/www.w3schools.com');">W3Schools HTML DOM Reference</a>.</p>
<p>The DOM , or Document Object Model is a way of referring to many of the parts of the document object, such as the HTML elements within. We already use this to call up form inputs so we can get their value. However, we can do more than just read off data. We can acually change the existing elements on the screen. In this case I&#8217;ll change the style.</p>
<p>On W3Schools I found the code snippet:
<pre><code>document.getElementById("id").style.property="value"</code></pre>
<p> This little piece of code would let me call up an element and change a property of it&#8217;s style. Using <code>onMouseOver()</code> and <code>onMouseOut</code> events would let me change the style to make it visible on the hover and then hide it again when the curser leaves.</p>
<p>The styles applied would be something like:</p>
<pre><code>#hiddenlist {
  position: absolute;
  left: 5000px;
  margin-bottom:0px;
}</code></pre>
<p>Again, this tells the popup list to hide.</p>
<p>then the javascript functions:</p>
<pre><code></code></pre>
<p>The first of these two function reveals the popup list, the second hides it again.</p>
<p>And the HTML:</p>
<pre><code>&lt;ul&gt;
  &lt;li&gt;
    Hover Over Me
  &lt;ul&gt;
    &lt;li&gt;Lookit Me!&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</code></pre>
<p>The two JavaScript events in the HTML call the <code>showList()</code> function when the cursor is over the <code>&lt;li&gt;&lt;/li&gt;</code> and call the <code>hideList()</code> funtion when the cursor leaves. As the popup list is within the <code>&lt;li&gt;&lt;/li&gt;</code> it stays open when the cursor is over it.</p>
<p><a href="http://ogremindes.net/wp-content/uploads/2006/03/jsdemo.html" >An example of the code in action.</a></p>
<h4>The Road Goes Ever On</h4>
<p>Well it looks like it works, so job&#8217;s done, time to apply it to the category list. All it would take is giving each of the lists a unique id and having a copy of each function to match. &#8230;or not. You see, the list is automatically generated by a wordpress function, so there is no easy way for me to add ids. And I dont wan&#8217;t to have repeated code apout the place and besides, if I add new parent categories in the future I don&#8217;t want to have to go back and edit the template again. Also, it may be more useful to have clickable toggles than roll over effects&#8230;</p>
<p>And so the quest continues. I&#8217;ll be looking at the hierarchy of the DOM in the near future, and maybe I&#8217;ll end up writing a custom category list function in PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://ogremindes.net/blog/the-quest-for-a-better-category-list-part-the-first-a-basic-cssjavascript-popup-menu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

