Re: [VE][64] Error Message Feedback

Jukka K. Korpela wrote:

> On Sun, 30 Jan 2005, DjMafia wrote:
> 
> 
>><script type="text/javascript"> if (!chatterbox || chatterbox != 'ok') {
>>var txt = "This <a href="http://chatter.flooble.com/">flooble
>>chatterbox</a> is"
> 
> 
> Quick answer: put all script code into an external file that you refer to
> via a src attribute in a script element. Alternatively, unless you have
> some particular reason to use XHTML, switch to HTML, where the problem
> is smaller (you only need to worry about things like </a>, which you
> can write as <\/a> in JavaScript).
> 
> In XHTML, which you seem to be using, a script element's content is
> #PCDATA (parsed character data), and hence e.g. "<a" is interpreted as
> starting an element (but no elements are allowed inside a script element).
> 
> In principle, you could replace any occurrence of "<" inside a
> script element by "&lt;". This would be fine as far as XHTML is concerned.
> But this would not be practical, since Internet Explorer does not actually
> "do XHTML" but e.g. interprets the content of a script element by
> classic HTML rules (to the extent it plays by any rules).

Not convinced this is really the cause of the problem; surely it is the
double use of '"' that is the problem -- used first as delimiter
for the var txt assignment, and then again within the RHS of the
assignment to delimit the replacement text for the href.

Philip Taylor

Received on Sunday, 30 January 2005 17:11:36 UTC