[WEB4LIB] Problems with page validation

Thomas Dowling tdowling at ohiolink.edu
Tue Aug 29 13:51:32 EDT 2000


> The recent discussion of document declarations and page validation
reminded me
> of a question I've been meaning to ask.
>
> I've been including declarations for a couple of years after the
validators
> suggested it.  I was using HTML 2, since I was writing for Lynx and VT
200
> terminals.  Now I'm converting to 4.01 (still making them
Lynx-accessible,
> though).

Natch--Lynx is one of the best HTML 4.0x browsers there is.

>
> My problem has come in two areas.  First, I use thecounter.com's
Javascript
> counter.  I like it a lot, but validator.w3.org complains about some
errors and
> won't validate my home page <http://www.scpl.org>.  Since I want to
put the
> HTML 4.01 logo on my pages, should I ignore this?  I'm not a
Javascript
> programmer, so I can't tell what should be changed, or if adding an
alt tag for
> the invisible counter would cause any problems in its operation.
>

I recommend the WDG's validator at
<URL:http://www.htmlhelp.com/tools/validator/>.  They have put a lot of
effort into making nsgmls' error messages human-comprehensible, with
lots of helpful links to their invaluable HTML guide.

It looks like you just need a couple of script-related tweaks to
validate: in HTML 4.0, <SCRIPT> has a required TYPE attribute; for
back-Netscapewards compatibility, you probably want to retain the the
deprecated LANGUAGE attribute:

  <script type="text/javascript" language="JavaScript1.2">...

HTML 4.01 changes the content model for <SCRIPT> in such a way that you
need to avoid anything an HTML validator sees as an element end-tag.
You typically do this by escaping the slash in any end-tags you need to
write into the script.  So, for example:

  document.write("<h2>Foo<\/h2>")

> Secondly, the validators don't like the structure of some of the URLs
I link
> to.  My local information pages at <http://www.scpl.org/local> link to
assorted
> census statistics, maps, campaign contributions etc., and the &s in
the URLs
> give the validator fits.  I can't change any of those...

Well, you *can* change them if you want.  I'm not aware of any browser
that fails to understand a link like:

  <a href="foo.cgi?name1=bob&amp;name2=ray">

(Though you need to be careful if you ever have to use that link outside
of an HTML document).

> ...so should I just put the
> logo on and ignore those errors?
>

If it was me, I wouldn't add the logo--what does it mean to the majority
of your users anyway?  But then, if it was me, I wouldn't use a counter
like this either.


Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu



More information about the Web4lib mailing list