Jump to content

triple quote


wannabe_god

Recommended Posts

You have to escape the quotes of the same type the string is in, by the backslash.

document_write('<td onmouseover="alert(\'hi\')">hi</td>');
But there are lots of other similar valid ways, you can use HTML entities inside the alert() function ("), you can use double quotes for the string and escape the inner double quotes, instead of the singles, etc. Possibly even more qays. So this is only an example :):)This is how I would do it when I use javascript:
document_write("<td onmouseover='alert(\"hi\")'>hi</td>");
Because I want to use the same quot syntax I use with PHP, and then I am forced to use double quotes for the string, to be able to escape signs in it (when the string is single quoted in php, it doesn't parse special characters)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...