Tuesday, October 10, 2006

Blogger and The Script Tag

By default, the blogger editor complains when you attempt to save a post with the <script> tag embedded inside of it. But as the content below shows, if you simply ignore the warning, it will indeed work just fine.


As an aside: gosh I love Prototype. The above was written as:

 var words = ["using", "a", "src", "attribute", "on", "the", "script", "works." ];
 words.each(function(w) { document.writeln(w +  " "); });

You just have to love the use of anonymous functions and Lisp map like functionality. Sorry, couldn't resist.

Thanks to Digital Inspiration for the script tip.


  1. Anonymous11:24 AM

    just to clarify, functions as first-class datatypes are thanks to core javascript, not prototype. combined with the ability to easily extend standard object types (like Array), the each/map function is basically trivial to write.

    all i'm driving at is that perhaps it should say "gosh i love javascript!" :) cheers.

  2. Good point.

    I do love JavaScript, and the ease in which you can extend basic objects in a painless manner.

    What I was driving at with Prototype (but of course didn't say well) was how with a single include, I can have access to not just array.each(), but a whole library of functions which make use of functions as first class citizens.

    So, maybe I should have said: "Gosh I love the way Prototype makes JavaScript more Lisplike without me having to do a bit of work."


    Thanks for the comment.