My utilitarian view of things:
Caroline said:
Thank you Laurent and Guy for your quick replies;
However, for didactive purposes, I would like to understand the details:
- What is wrong with the javascript: pseudo protocol in a link?
If you have this and a browser without javascript (or javascript
turned off) will have no idea what to do with the link. Thererfore,
even if you are coding for javascript, it is good general practise
to use onClick.
- what is 'return false;' used for excactly?
return false tells the browser to stop doing what it would
normally do in handling the event. In the case of a link,
it would tend to follow the link, but the "return false;" should
suppress this tendancy.
- What do you mean exactly by 'use the DOM Level 2 to access the text
node you want to modify?'
This is not your exact answer but an indication:
In early browser history people tended to view a page as
basically text that you marked up for display.
More recent browsers acknowledge that a document
is actually a graph where each all of the pieces of the
document are nodes in the graph with all sorts of
attributes that determine how the pieces display and
what can happen to/with them.
'use DOM Level 2' means to basically acknowledge
this view and explicitly operate on nodes (as opposed
to spewing HTML (with .innerHTML, say) and leaving
the browser to implicitly create the nodes) by using
constructs provided for this purpose
(such as document.createElement or
document.createTextNode and insertBefore).
Csaba Gabor from New York