What's wrong with JavaScript?

by Francois Joseph de Kermadec

One may or may not like round corners. That, after all, is a matter of taste. But I somehow fail to see what's wrong with using JavaScript to artificially round corners on some divs. Could you enlighten me?


2006-05-05 18:23:55
I feel that using javascript to round corners is really a choice. When I was designing nemu-nemu.com I had a heck of a time deciding which was the best and easiest way to round that didn't give me nightmares. After trying a ton of techniques I finally gave in and used NiftyCorners. I chose Nifty for a few reasons: it was easy to implement, it was easy to remove, it degraded nicely (if the browser didn't support it or didn't have javascript it would show your normal unrounded corners instead), and it didn't give me a headache trying to make them work.

I think Nifty is probably the easiest to implement and it's fairly lightweight compared to making graphic images of all corners in all different colors for each instance you want to round. I haven't had any complaints so far...

Josh Peters
2006-05-05 19:24:52
One caveat about using Javascript to generate rounded corners is the half-a-second it takes to do it. For most customers/users it is pretty acceptable and not a big deal at all, but it's often a big deal to designers and user interaction people.

I say use JS + CSS for everything that's not semanticly beneficial, but then again I'm a programmer-type.

Lee Noble
2006-05-06 10:14:34
If you do stick to using CSS with multiple nested DIV elements then the problems of layout only remains an issue if you are hand coding multiple pages. Using a template in some scripting language or other (if appropriate) will mean you only have to make the change once when it comes to it anyway.
2006-05-06 16:16:56

Thanks for taking the time to share your experience, it is most interesting!


2006-05-06 16:18:46

Yes, there indeed might be a slight delay while the script is being processed although I never uncovered one in my testing -- or any one longer than say, the time it takes to load that tiny brand logo in the upper left corner of the screen.

Of course, the temptation to go overboard with JavaScript and overload one's site is to be avoided and you are right in pointing out it is a potentially slippery slope.


2006-05-06 16:20:59

That is very true. In the case of a templating system or other CMS, either method, CSS or JavaScript, would only have to be used once. In this case, I guess CSS would have a light advantage. Of course, it all depends on whether the CSS is used to load images or not, which may again tip the balance.

I am somehow reluctant, as I said in previous blog posts, to use CMSs unless absolutely necessary but it is true many sites rely on them nowadays.


2006-05-08 06:49:18
One could write an article titled, "What's Right With JavaScript?" but the hard part would be saying "not very much" in enough words to fill an article.

Like Flash intros, using Java$#!+ to do goofy things like rounded corners practically screams, "I don't have any worthwhile content on this site, so I'm going to give you funky effects -- that may or may not work on your browser -- as a poor substitute."

I know I'm the voice in the wilderness on this issue, but come on, folks. Fill your site with informative or entertaining content, and people won't care if you use the newest k3\/\/l web effects.

2006-05-08 10:22:50
Je me doute que tu es d'origine francophone alors il me sera plus facile de m'expliquer dans ma langue:
Pour chaque tâche spécifique un outil spécifique. De même que l'on n'utilise pas un marteau pour visser, de même le JavaScript ne doit pas se mêler de style. À chacun son métier et les vaches seront bien gardées. :)
2006-05-09 10:47:14

First of all, thank you for taking the time to comment, I really do appreciate it.

You seem to imply "web effects" and valuable content are mutually exclusive. What about sites that bring on both? I entirely agree with you that an overload of effects will never replace actual content. However, what about effects that can help underline the content's meaning?


2006-05-09 10:49:49

Merci de ton message et de tes commentaires!

LOL! En effet, un marteau n'est pas pratique pour visser... JavaScript est certainement plus approprié à la création de contenu dynamique qu'à la réalisation d'effets de style. Pourquoi cependant lui interdire de créer... des styles dynamiques, si j'ose dire? Je serais heureux de poursuivre cette discussion plus avant.

Merci encore,