How can I write an alert whose content has a semicolon ;
if it is considered as a syntax element?
Example:
<span onmouseover="alert("isso significa bla bla; voce acredita?";>Isso</span>
How can I write an alert whose content has a semicolon ;
if it is considered as a syntax element?
Example:
<span onmouseover="alert("isso significa bla bla; voce acredita?";>Isso</span>
It will only be part of the JavaScript syntax if it is outside the string, strings begin and end with quotation marks:
"..."
Or apostrophes:
'...'
The problem with your script is that you are using "
in HTML and alert
(which is Javascript injected) at the same time, except that a HTML closing quote is missing:
<span onmouseover="alert("isso significa bla bla; voce acredita?");>isso</span>
To avoid this, within the events in the HTML attributes use only apostrophes, test:
<span onmouseover="alert('isso significa bla bla; voce acredita?');">isso</span>
You can also use the "
entity within the HTML event attribute, which will be equivalent to the quotation marks:
<span onmouseover="alert("isso significa bla bla; voce acredita?");">isso</span>