Currently playing on my computer (tune in: pls, asx)
The Daily Biff
     
 
Sat, 22 Dec 2007

Learning Ajax
A couple of days ago, I inserted "Now Playing" information on my blog. As I noted, it's not extremely useful (you cannot "listen in") - it's just geeky. I added a bit of pizazz to the feature by adding a pop-up "tooltip" that displays a list of detailed information about the track currently playing. The information includes the track title, the artist, the album, track number, track length, and a jpeg image of the cover art as well. Again... not extremely useful, just geeky. Go ahead and move your mouse over the "Now Playing" graphic in the upper right corner of this blog - then wait for half a second for the information to display.

The information in the pop-up window is populated via an asynchronous javascript call to a CGI script that just dumps the contents of a text file. There is nothing really novel about the system (it was extremely easy to accomplish), but this is my first experience using Ajax programming. Learning Ajax is one of those items on my long "To Do" list of stuff I should learn to keep my technical skills "fresh" (just in case I never need to start "fresh" at a new company). So I'm very pleased I got off to a successful start after only a couple of hours reading some on-line tutorials.

If interested in the code that accomplishes the effect, then you can view source... here are the relevant parts of the HTML:

    <div id="nowplayingtooltip"></div>
    <div class="nowplaying">What I'm listening to:<br/>
    <a onMouseOver="getNewContent(); ddrivetip('loading... please wait')"
      onMouseOut="hideddrivetip()" onClick="openWindow(this.href, 420, 180); return false"
      href="http://rus.berrett.org/now_playing/"><img id="nowplayingimg" border="0"
      src="http://rus.berrett.org/now_playing/nowplaying.png"></a>
    </div>

My blog's javascript code is here. The relevant section is labeled "ajax stuff".

Note: the pop-up includes a jpeg image of the cover art. But for whatever reason the image is not displayed in MS Internet Explorer (5, 6, or 7). Not sure why. It works great in Firefox though. *shrug*

(Update Fri Dec 28 10:05:32 PST 2007 // my -> by)

:: Posted by rus on Sat, 22 Dec 2007 11:02 pm
:: Filed under /tech



         

December 2007
Sun Mon Tue Wed Thu Fri Sat
           
22
         

About
The Daily Biff
Rus Berrett's weblog

Contact Me
Email: rus at berrett dot org
AIM: biffordtdavis

Search 'The Daily Biff'



Proclamations
Exaggerated opinions of my own importance. Proceed with caution.

Buy Me Stuff
My wish list is my gift to you (yes, shameless, I know).

Subscribe
Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Categories
You can isolate posts by category using the following links.

  •   ·x10 (1)
  •     ·2005 (23)
  •     ·2006 (18)
  •     ·2007 (17)
  •     ·2008 (27)
  •     ·kids (1)
  •     ·meat (14)
  •     ·cola (2)
  •     ·milk (2)
  •     ·meat (1)
  •     ·utah (5)

Archives
Past entries are available for review.

Blogroll
These are a few blogs run by my esteemed friends and colleagues. My personal comments about the blog (and its author) can be accessed by clicking on the "wtf?" graphic to the immediate right of each entry (wtf = "What the flip?" as in "What the flip is grandma doing at the sand dunes?").

Family

What the flip is "Yatyk's Musings"?  And who the flip is Mark Berrett?

Friends

What the flip is "The Improvist"?  And who the flip is Dan Brian?
What the flip is "The Borel-Cantelli Lemma"?  And who the flip is Norm Jones?


    
 
    Valid CSS!

Valid HTML 4.01 Transitional

Powered by blosxom