Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
No such thing as a small change
 
PerlMonks  

Re^2: CGI, Javascript and Single Quotes

by rashley (Scribe)
on Nov 15, 2006 at 13:28 UTC ( [id://584239]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: CGI, Javascript and Single Quotes
in thread CGI, Javascript and Single Quotes

This doesn't seem to be the case for me.

I tried inserting ' in place of ' on my little test HTML page, and the Javascript bombed.

  • Comment on Re^2: CGI, Javascript and Single Quotes

Replies are listed 'Best First'.
Re^3: CGI, Javascript and Single Quotes
by ikegami (Patriarch) on Nov 15, 2006 at 14:05 UTC

    Your browser is broken if this is a problem. According to the strict DTD, what's in between script tags and event handlers is to be considered CDATA, which is defined as "a sequence of characters from the document character set and may include character entities." ' is a character entity.

    IE6 and FF1.5 had no problems handling entities in the event handler when I tested them using the following HTML doc:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <title>test</title> <p><a onclick="alert(&#39;FlagNotesTable&#39;);">escaped</a> <br><a onclick="alert('FlagNotesTable');">Not escaped</a>

    Update: Added first paragraph.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://584239]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.