Adding an Icon to the Buddy List

  1. Follow the steps outlined in the Adding the Buddy List Widget to your Page section.
  2. Add the following code to your document after the reference to aimapi.js:
    <script type="text/javascript">
    
    function launchBuddyList() {
        AIM.core.addCallback( AIM.params.callbacks.listener.buddylist, "setTimeout( addIcon, 1000 );" ); 
        AIM.widgets.buddyList.launch();
    }
    
    function addIcon() {
        var oBuddies = AIM.util.getAIMIDCollection( document.getElementById( "AIMBuddyListContainer" ) );
        var i = oBuddies.length;
        while(i-- > 0) {
          var image = document.createElement("img");
          image.setAttribute( "src", "/aimclient/stylesheet/run_man08.gif" );
          image.className = "myIcon";
          oBuddies[i].insertBefore(image, oBuddies[i].firstChild);
        }
      }
    </script>
    

    Note: It's a good idea, though not required, to place the above JavaScript (without the <script> tags) in its own file and reference it from your document. This will reduce the size of your document and allow the user's browser to cache the script.

  3. Finally, change the anchor element you added from the Adding the Buddy List Widget section to this:
    <a onclick="launchBuddyList();return false;" href="nojavascript.html">Launch my Buddy List</a>