Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Help with Local Time Script Mod

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    And yet another thing, though I'm not certain, it would probably be better to choose one server mode, not set two or more on the same page.

    What server side languages does your server support?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    One big improvement you could make is to remove that horrible innerHTML usage.
    Code:
    Function.id = function(a) { return a; };
    
    function stringsToImages(strings, getImageUrl) {
      getImageUrl = getImageUrl || Function.id;
    
      for (var r = document.createDocumentFragment(), i = strings.length; --i >= 0; )
        r.appendChild(document.createElement("img")).src = getImageUrl(strings[i]);
    
      return r;
    }
    Then something like:
    Code:
    var el = stringsToSpan("18:45".split(""), function(s) { return (s === ":" ? "colon" : s) + ".png"; });
    ... will yield the fragment you want.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •