RobG napisal(a):
Luke Matuszewski wrote: RobG napisal(a): [...]A reference to where the table came from would be helpful, or did you
make it yourself?
It comes from JavaScript Bible , 5th Ed by Danny Goodman (if i were
younger i would say :O :O :O .... ;-) ).
Goodman's book is not held in high regard, you might be better to not
use it at all. :-x
HTML 4.01 does not specify an onclick attribute for the HTML element,
the body element would be a more suitable location.
It refers not to <html> element (tag) but i guess the most of html
elements which has %events entity in DTD.
Not sure what you mean. Your original post had code with an onclick
attribute in an HTML tag, Goodman's table (as posted) seemed to suggest
that it was OK to added them. The HTML element has no events, so no
attempt should be made to to add them. If that is what Goodman's book
suggests or advises, then it's a good example of why you shouldn't use it.
Ok as i read you reply i saw the onclick event in <html> element -
which is not good practice as HTML 4.01 spec states that <html> element
has no onclick event...
Thanks for answer, and sorry for example which is not valid HTML as
w3c.org states...
My experience on reading different books shows that in those books
there is only a suggestion on how things work and if they don't refer
to specifications it is ok - but that i have learned from experience.
Worst books refer to specification and provide material/examples that
are not valid when comparing what specification says.
Best way is to know specification or has quick access to them (as for
eg. to the Internet for checking w3c.org HTML specs) and then support
our knowledge by reading books.
Despite what the specification says, some browsers may support event
attributes being added to the HTML element. But that does not make it
OK to do so, as it can't be expected to be reliable across all browsers
conforming to HTML 4. There are a great many more browsers than those
in the table and mobile devices will likely grow the number hugely.
Yes, i agree and sorry for my (well Danny Goodman was first) example
provided from his book.
My way to learn things has evolved as i was misguided by many different
books... and i am in stage where i can say i do following:
- i learn/know the specification and how to search them;
- i read (now only fragments) of books which reveals some asspects of
knowledge and how this knowledge deals with real world (so eg. how it
works on different user agents), and while reading i especially try to
catch fragments which is not valid against specification;
- i try to remeber things that are specification valid and how they
work in real world today, cause only then i can say that maybe it will
work on the future and maybe they will work on not standards compilant
future devices - as producents of such devices will probably try to not
break compatibility which older versions (versions of devices which
work today);
BR.
Luke