I'm not sure, but it might take the // as an escape character and only
insert the one /, I also use the single quote ' instead of the double quote
" when generating HTML, since it doesn't matter to the browser and then I
don't have to pre-append the /. What does the generated HTML look like?

Just another hint. Use StringBuffer instead of adding one string to another.
It is a lot faster.

I.e.
StringBuffer htmlBody = new StringBuffer(1024);
htmlBody.append("<SCRIPT LANGUAGE=\'JavaScript\'> <!-- Hide script from
old");
...etc.
and then
htmlBody.toString();

Hope this helps. Regards.

Marius


> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Tom
> Kochanowicz
> Sent: Wednesday, March 10, 1999 4:33 PM
> To: [EMAIL PROTECTED]
> Subject: ? embedded javascript
>
>
>     I have embedded some javascript into my servlet. The script works
> fine, but when I add the code to prevent old browsers from seeing the
> javascript it does not work. Any Ideas?
> The code is below...Thanks
>
>  htmlBody += "<SCRIPT LANGUAGE=\"JavaScript\"> <!-- Hide script from old
> browsers ";
>     htmlBody += " var submitted = false;";
>     htmlBody += " function doSubmit(form)";
>     htmlBody += " {";
>     htmlBody +=  " if (!submitted) {";
>     htmlBody +=   " submitted = true;";
>     htmlBody +=   " form.submit();";
>     htmlBody +=  " }";
>     htmlBody += " }";
>     htmlBody += "// End hiding script from old browsers--></SCRIPT>";
>

Marius Botha.vcf

Reply via email to