In article <11************ **********@l41g 2000cwc.googleg roups.com>,
<va*****@agilis .st.com.sg> wrote:
I am using "C" to generate the javascript code. And i am getting the
following error message "Unterminat ed string literal" in the mozilla
webbrowser for the following syntax.
unsigned char *Buf="Test"
printf("alert( \"%s\");\n\n",B uf);
I see an error message alert("Test Unterminated string literal in the
Javascript console of Mozilla web browser.
I take it this is intended to be the C code that runs within the
context of a CGI script that will send output to a browser?
You are missing the semicolon after the declaration line.
One variation you could experiment with is to use
printf("alert(' %s');\n\n",Buf) ;
Either way, in the general case unless you know that
the contents of Buf is safe, you should pass it through a routine
to escape any quote-marks it has internally.
--
Ceci, ce n'est pas une idée.