David Findley's Blog

My little home in the cloud.

November 2005 - Posts

Javascript libraries roundup

Here is a great list of javascript goodies for all you AJAX/Web 2.0 junkies:

http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup/

 

Posted: Nov 15 2005, 07:27 AM by findleyd
Filed under:
Cheat Sheet Roundup - Over 30 Cheatsheets for developers

Time to get some new ink carts for my printer ;)

http://www.petefreitag.com/item/455.cfm

 

E4X! Where have you been all my life?

How in the heck did I miss this? After seeing a couple of blog posts here on weblogs.asp.net about E4X I went out and did a bit of googling. In case you missed the boat like I did here's the scoop: E4X is a set of extensions to java script that was standardized back in June of 2004. It basically makes XML a first class citizen of the language (hmmm wonder where some of the ideas for XLINQ came from?). There are a couple of implementations of note that I have found. Namely firefox 1.5rc1 and macromedia action script.

Now for the bad news. From w3schools.com : "So far there is no indication of E4X support in Internet Explorer 7". Sorry IE, all the cool stuff in web browser land is hapening outside of Microsoft.

In the mean time go get Firefox 1.5 and try this out:

<html>

<head>

<script>

function createHeaderRow()

{

      return <tr><th>First Name</th><th>Last Name</th></tr>;

}

 

function onLoad()

{

      var people = new XML(document.getElementById("people").innerHTML);

      var table = <table border="1" />;

      table.tr += createHeaderRow();

      for each (var person in people.person.(@state=='active'))

      {

            table.tr += <tr><td>{person.firstname.text()}</td><td>{person.lastname.text()}</td></tr>;

      }

 

      var source = document.getElementById("source");

      source.value = table;

 

      var output = document.getElementById("output");

      output.innerHTML = table;

}

</script>

</head>

<body onload="onLoad()">

 

<div id="output"></div>

 

<hr>

 

<textarea id="source" cols="80" rows="20"></textarea>

 

<script id="people" type="text/xml">

<people>

      <person state="active">

            <firstname>David</firstname>

            <lastname>Findley</lastname>

      </person>

      <person state="inactive">

            <firstname>Joe</firstname>

            <lastname>Schmoe</lastname>

      </person>

      <person state="active">

            <firstname>Lance</firstname>

            <lastname>Hunt</lastname>

      </person>

</people>

</script>

 

</body>

</html>

 

some additional resources:

 

http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-357.pdf

http://developer.mozilla.org/en/docs/E4X

http://www.w3schools.com/e4x/default.asp

http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/

 

 

 

 

Posted: Nov 08 2005, 09:31 PM by findleyd | with 3 comment(s)
Filed under:
More Posts