"KC Wong" <ev**********@yahoo.com.hk> writes:
Thanks, Lasse... I haven't coded any JavaScript for years, but recently
picked it up again because I have to integrate 2 web sites. Seems I've
forgotten most of the good practices :(
Years ago, there were two browsers and almost no standards, so good
practices were often anything that worked. While IE still has a huge
market share, there are other browsers out there. Each is probably
counted only in singe digit percentages, I bet they will grow as more
people start using alternative platforms, e.g., mobile phones with
browsers (where Opera is currently popular with phone makers).
<!--
You don't need HTML comments in Javascript
That's one habit I learned from a book many years ago... so that if the
browser does not support JavaScript, your code won't show up on the page.
Almost correct. If the browser don't understand the script *tag*, it
will show the contents, and you need to hide it with HTML comments. If
it understands the script tag, i.e., understands HTML 3.2, then it
doesn't matter if it can execute the script or not, it still won't
show the contents.
HTML 3.2 was made a recommendation in January 1997, and any serious
browser made after that (and most of the ones made while HTML 3.2 was
in development) will not need the script to be hidden. I think it is
safe to say that no browser in current use needs the HTML comments.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'