-4
How do I write an Alert whose content has a dot and comma ;
whether it is considered as a syntax element?
Example:
<span onmouseover="alert("isso significa bla bla; voce acredita?";>Isso</span>
-4
How do I write an Alert whose content has a dot and comma ;
whether it is considered as a syntax element?
Example:
<span onmouseover="alert("isso significa bla bla; voce acredita?";>Isso</span>
1
It will only be part of the Javascript syntax if it is outside the string, the strings start and end with quotes:
"..."
Or apostrophes:
'...'
The problem with your script is that you are using quotes "
in HTML and alert
(which is Javascript injected) at the same time, apart from missing an HTML closing quote:
<span onmouseover="alert("isso significa bla bla; voce acredita?");>isso</span>
To avoid this, inside the events in the HTML attributes use only apostrophes, take the 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>
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.