RE: Using Form Elements for Pages only Intended for Printing

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Well it's better (but having it as an external script seems very
> wasteful.)

It hides the script from non js-aware browsers in a way that is both
valid HTML (which may choke on <[CDATA[) and valid XHTML (which
doesn't guarantee that anything in a <!--comment--> won't be deleted
before parsing). Besides which external scripts have a speed
advantage if the script is used more than once (albeit this only
really happens with larger scripts), and it makes source code easier
to manage especially in the common situation where not all the people
working on the HTML are familiar with js.

 but it's still not perfect, you're now assuming the
> javascript: pseudo protocol exists, which is unwarranted,

I do prefer to use onclick, it is legalistically better, I agree.

 also why have
> the DIV?

<script> is a block level element. As such it cannot appear in an
inline situation. Also if a script document.write's then it should be
seen as being replaced by that code. The code must be valid both
before and after this replacement. Hence outputting a <a> element
without also outputting a block element like <div> is generally
illegal, unless the script is in an element that can accept either
block or inline elements (div, td, th)

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPD2yI4Fpv9f1Mr0YEQIrrwCguv5hAwXoLGPwXvCHTqD4uzxp1CsAn2ju
4hjdEhs+Ub5BTfC2pIqPiEZW
=ts7H
-----END PGP SIGNATURE-----

Received on Thursday, 10 January 2002 10:25:08 UTC