Posting an Opera button on your website or blog is a great way to encourage people to try out the browser — but what if the visitor already uses Opera? It shows solidarity, but what if you could show them something else, something that is new to them?

You might want to replace your regular Opera banner with an ad for Opera Mini. Or show them another graphic of your own design. Or maybe not even a graphic, maybe post some sort of message, like “Opera spoken here!” or “Welcome, Opera visitors!”

It’s relatively simple to do this in PHP, or ASP, or some other server-side script…but sometimes you have to stick with static HTML. Well, client-side JavaScript can replace chunks of your page, and here’s how to do it.

1. Put the following script in a file called operalinks.js:

function replaceOperaLink(linkID) {

if(linkNode=document.getElementById(linkID)) {

if ( 0 <= navigator.userAgent.indexOf('Opera') ) {

var newButton=document.createElement('span');

newButton.innerHTML = '<a href="http://www.opera.com/">Glad to see you're using Opera!</a>';

var parentNode=linkNode.parentNode;

parentNode.replaceChild(newButton,linkNode);

}

}

}

For the innerHTML section, you can plug in a new link and banner, or a special message, or anything you want. (Just make sure that you put a backslash () in front of any apostrophes you use.)

2. Put a unique ID in the tag for your regular Opera button. Use the outermost tag that you want to replace. For example, let’s start it off with this:

<a id="OpLink" href="http://www.opera.com">Download Opera!</a>

3. Load the script in your document’s <head> section:

<script type="text/javascript" src="operalinks.js">

4. Call the function in the body onload event using the ID you chose in step 2:

<body onload="replaceOperaLink('OpLink')">

When the page loads, the script will check the visitor’s browser. If it’s Opera, it’ll replace the banner with whatever message you chose in step 1. It’s compatible with both HTML and XHTML, and you don’t need to worry about using <noscript> tags to make sure the banner still shows up for people with JavaScript disabled.

*This post originally appeared on Confessions of a Web Developer, my blog at the My Opera community.

I’ll always remember a line from a play I was in during college. It was an original musical, and the composer couldn’t come up with a good line by the time he had to hand out the scripts, so he filled it in with “Come around and schmoo” just to keep the rhyme in place. Oddly, I can’t remember the line he finally replaced it with.

And of course, Firefox’s cookie preferences were labeled “Cookies are delicious delicacies” for so long during the beta period that by the time they wrote a real description for 1.0, someone wrote an extension to put it back in!

Well, sometimes dummy text makes it through “rehearsals,” so to speak. Jim Heid found live sites with various kinds of filler text. Not just the ubiquitous “Untitled document” (millions of pages), but samples of “lorem ipsum” filler and even ~250 hits for “this is placeholder text” (whoops, I’m gonna skew those results a bit.)

(via Scobleizer, who recommends using “xxxxx” exclusively for placeholders.)

Here’s a pair of excellent articles about how to avoid cluttering up your website so that people can actually see your content. The article is, however, hampered by appearing on a site that seems to violate every usability principle imaginable…. to the extent that the second one showed up on the Cruel Site of the Day [archive.org]. From the introduction:

We’ve all visited websites that made us wince. You know what I mean: full of distracting animation, flashing text, and enough other clutter that it reminds you of a Victorian home filled to bursting with knick knacks. Are you guilty of filling your website with useless junk? Christian Heilmann takes you down his checklist of website clutter. You just might find yourself considering a redesign.

Yeah, that sounds like a description of Dev Articles to me. I count no fewer than 8 ads on the first page, 6 of them animated. The text is buried in a morass of advertisements and navigation that make it extremely difficult to actually read the article.

It reminds me of a book called Fumblerules, which collected (or possibly originated) guidelines like “Always proofread carefully to make sure you don’t any words out,” or “Plan ahead” with the last few letters scrunched together to fit on the page. These were designed to make their points by deliberately breaking the rules to make them more memorable.

Well, there’s always the Daily Sucker.

Update: I checked out the author’s website, which demonstrates he has the sense of taste and aesthetics one would expect from his articles. It really is too bad DevArticles isn’t willing to take his advice.