PB : document.write some HTML code with <script src=".."> tags

S

Sylvain Langlade

Hi all,


I'm facing an IE6 strange behaviour. This is for a french IE6 SP1 with this
week patch installed.

I'm doing a script that should strip the current document to a printable
version. It is rather simple in concept :

take your original HTML code :

<html>
<head>
<script language="Javascript" src="/lib.js"></script>
</head>
<body>
<..... nice little GUI with tables, that breaks the printer page setup ....>
<div id="myInfo"><.... my content ...></div>
<..... end of the GUI ...>
</body>
</html>

Everything works fine. Transform it to

<html>
<head>
<script language="Javascript" src="/lib.js"></script>
</head>
<body>
<.... my content ...>
</body>
</html>

This part is OK, so I've got myself a variable with this new HTML code. I
open a blank popup window, copy the HTML code into it and... it breaks due
to errors in the javascript.

I've tried to debug this stuff, and it appears that the included javascripts
(there are 3 of them in the <head>, plus another one in "my content") are
the culprits. Well, IE6 is the real culprit : I'm a french coder, so I have
some accentuated chars in my comments and strings. And those chars are
defanged / mangled by IE when they are loaded within my on-fly created
document.

That's bad because my strings are mangled. But also because when such a char
is placed on the last position of a one-line comment, the following carriage
return does somehow disappear and generate syntax errors.

I tested the very same javascript function with Mozilla, it works like a
charm. Is there any way to tell IE to not mangle my code when inserting
javascript scripts in my new document. Like a locale setting for this
document ?

Thanks in advance.
 
S

Sylvain Langlade

Ok, one precision :

The popup opens, display my stripped down page with no display errors.
Everything is fine for much of the pages I tested. Only the ones with the
"accentuated" javascript includes show this behaviour.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top