- From: Tigger <tigger@lvlworld.com>
- Date: 13 Jun 2020 23:44:06 -0000
- To: www-validator@w3.org, jens@meiert.com
The JavaScript should have been something like:
var r = document.getElementById("result");
var d = document.createElement("font");
d.setAttribute("color","#ff0000");
d.textContext = "Error";
r.appendChild(d);
Using innerHTML is seen as bad practice.
https://stackoverflow.com/questions/2946656/advantages-of-createelement-over-innerhtml
-Tig
> Original message:
> > Line 32, Column 115: end tag for element "FONT" which is not open
> >
> > …ntById("result").innerHTML = "<font
> color=\"#ff0000\">Error</font>"; return; }
>
> To bypass this particular error you’d need to escape the backslash in
> `</font>`, as in
>
> <font color=\"#ff0000\">Error<\/font>
>
> However, this is generally poor code—poor HTML, poor CSS (which should
> be used instead of “font” elements and “color” attributes), poor
> JavaScript. I don’t have a good reference at hand to point you to, but
> reconsider this and research more modern approaches to web
> development.
>
> Best,
>
> Jens.
>
> --
> Jens Oliver Meiert
> https://meiert.com/en/
Received on Saturday, 13 June 2020 23:44:20 UTC