JavaScript Image Replacement

by Christian Heilmann

57 Reader Comments

Back to the Article
  1. re: … Heilmann (write it any way you want)

    Sorry Chris… it was my lapsus kalamis.

    :: How could I answer to PPK’s claims if I didn’t get any?

    I meant on his post in ALA. When I first time read all (three days before) his replay were already here. Two days passed but it was totally ignored (looks like that yesterday).

    :: I like moose’s solution *** But what do you do now, when a client wants image replacement and it should work on IE5, 5.5 and 6?

    It is the question of web (web-publishing) understanding (imho): just to use scale-principe and to compare this: IE (x.yy) clients do not see the image but they have no any clue that image should be there – they just see the nice, real(!) heading (written by text and displayed by chosen style (font…)) which could be selected, copied etc… second case is that some other client, with strange browsing attitude (could browsing attitude be called as ‘strange’ at all?) means javascript on and images off doesn’t see the image, doesn’t see the real heading but see that ‘beautiful’ well known alt-image-replacement. So, I would not discuss in the field ‘What if…’ – just which of cases above author, you or anybody else, do prefer (maybe sometimes it depends on site content… maybe not). In moose case also, author do not need to write any of that meaningless warnings as ‘Headings on this site are represented by images…’ etc… means: ‘please do switch this or that on or of…’…

    :: I was more insulted by your post than by PPK’s to be truthful.

    Good. It was the base idea – to push you on some action.

    :: He claimed that the dash in his name is not much of an issue, you tried yourself on sarcasm about it.

    ppk has ©opyright on his own name of course but has not (neither you)  copyright on inappropriate using of any person name in global so, as long as I am protecting his name, I am protecting my own name also or anybody else’s in the future.

    :: PPK doesn’t need anyone defending him***

    The same as above: I do not know him really but I didn’t like the case. My small two cents for better world tomorrow if you know what I mean (I think you do).

    What I also think is that conflict is finished: you have nice attitude and ppk is also back when read your answer. Nobody knew that you really did everything on the correct way (pre-publishing issues) but ppk didn’t know that also:)) so: you forgive him, he forgives you and all ok.

    :: I respect PPK a lot, and I respect a lot of people knowing much of CSS to come***

    Somebody here mentioned that all of this is because you are not one from ‘big five’ (or ten or hundred) well known web-developers… it is not true: I do respect few well known people also (why should not) but I was really shocked when saw moose ideas;  I’ve spent a lot of time browsing that site and sites of few of his friends. So fresh, so original… I mean we should respect work – not names only.

    Re: “I was more insulted…” I do apologize to you (so easy always to say that – never late) for your insulation but I can not apologize for my post. If you’d answer on ppk’s post faster, earlier, I’d never comment any article about javascript techniques (real amateur here – maybe just would post the moose solution link). So, Chris, I really want you to accept my ‘beg pardon’ and am sure that you will.

    At the end: I also can not understand people who are ‘abused’ with emotional ppk’s comment: sure that it had to be emotional – he did’t know that Chris wrote to him. At that time, his answer were so human, understandable, adequate… and good that Chris made everything clean.

    Copy & paste the code below to embed this comment.
  2. yes, I just this morning realised that the article has been published, as I spent the whole weekend with my girlfriend watching old Hitchcock movies as the weather was too foul to go out, and she doesn’t have a computer.

    Real life, sorry :-)

    Generally I like PPKs new article a bit more, he could have taken in account the changes I made to the script on it’s homepage (as stated in the article, the place where changes will happen), but you cannot expect everyone to check all before publishing an article.

    I also cringe a bit at
    “Worse, by publishing such articles ALA actively promotes a sloppy, irresponsible coding style that sharply diverges from the accessibility, web standards and structural coding the magazine purports to promote.”

    As adding an invalid attribute is not web standards, sorry.

    One of the big advantages of my version (and I would gladly include the loading of the image bit that makes PPKs version superior – albeit I won’t until he agrees that I can do that) is that the markup does not need any specialities. This may sound anal about xHTML, but there is a reason for it:

    I was also doing this script as a client needed it. They want it, yes, they want graphical headlines, and search engines should find the headlines, and they want them all in IE 5.5+. Furthermore they want WYSIWYG editing in the CMS, which means we get after we run the tagsoup created by WYSIWYG through and XSLT sheet, clean HTML, but we have no chance to add ids or, for that matter, even invalid attributes. Reading the content of the H1 and generating an image file name from it is not an option either, as we are working in 12 languages, including special characters which could easily result in headlines getting the wrong image.

    Now, this is a big project, big money, and everything the client wants.

    One example where my script DOES make sense. Not everything the article claims it does, but it works.
    The client can happily edit their articles and they get an extra field to add all the images.

    Copy & paste the code below to embed this comment.
  3. As Tom T pointed out, you can easily add custom attributes to XHTML as long as they are properly namespaced.

    Copy & paste the code below to embed this comment.
  4. I’m so glad PPK has shown us his true colors. Nothing worse than a confident dork.

    Copy & paste the code below to embed this comment.
  5. .

    Copy & paste the code below to embed this comment.
  6. >Generally I like PPKs new article a bit more,
    >he could have taken in account the changes I
    >made to the script on it’s homepage (as
    >stated in the article, the place where
    >changes will happen), but you cannot expect
    >everyone to check all before publishing an
    >article.

    Chris, I’m trying hard not to pick on you, but your comment is such a perfect handle for this important lesson that I couldn’t resist posting it.

    Publishing on a Serious Webzine: lesson 1

    If you publish so much as a word on a serious webzine like ALA, you cannot go back on it. Your article has to be perfect before you submit it.

    Chris, if you’d written your article anywhere else than on ALA I probably wouldn’t have noticed it, and if I had I’d have ignored it. I wrote my article solely because you chose to publish it on ALA (and because its editors chose to let it stand).

    I exclusively focus on your ALA article because ALA is a highly visible and respected webzine, and by default your article becomes highly visible and respected, too. It is this visibility and respect that I object to, and not the mere fact that you wrote your article.

    The next time you publish anything on a serious webzine, please make sure that it is perfect before submitting it, not after.

    Copy & paste the code below to embed this comment.
  7. I’m going to respond briefly to some comments made in this forum, and then I’m going to close the forum as it no longer serves as a calm or useful place for professional discussion of the ideas described in the article.

    Saturday morning I saw PPK’s first post (http://www.alistapart.com/discuss/javascriptreplacement/2/#c5727) and did three things in response:

      1. Article edit: linked to PPK’s current personal site, Quirksmode, per his suggestion.

      2. Article edit: corrected the spelling of PPK’s name, i.e. added the hyphen between Peter and Paul. PPK used to be an ALA author; I know how his name is spelled and would likely have caught the error if I had edited the article.

      3. Internal staff discussion: discussed PPK’s underlying point with the ALA staff and invited J. David Eisenberg (http://www.alistapart.com/authors/jdavideisenberg/) to join us as a technical editor in the areas of XML and the DOM — to which David graciously consented.

    http://www.alistapart.com/credits/

    David is a programmer, the author of a fine O’Reilly book on SVG, a co-founder of The Web Standards Project, and was a technical editor on my second book, Designing With Web Standards. His ALA bio page lists many of his past articles for A List Apart; more will be listed as soon as they are reformatted. David’s participation will help ensure that content quality in his area of expertise remains as high as ALA’s content quality in other areas.

    I considered these three actions an appropriate response: one that would make things better going forward. Anything else — such as responding in kind — I considered inappropriate.

    When we receive negative criticism, whether it’s discreetly handled in a private email message or posted publicly, and whether it’s delivered tactfully or not, we ask ourselves if there is merit to the complaint. If there is merit, we ask ourselves what we can do to improve. And then we take the necessary actions. And that is all that is needed.

    ALA tends to attract a considerate, professional crowd. Intelligent comments in the forum can be as useful and illuminating as the article to which they pertain. That is why we host a discussion forum.

    Our discussions rarely get hijacked and derailed, but if they do get bent out of shape, all we can do is shut them down. This forum is now closed.

    Copy & paste the code below to embed this comment.