Re: Wrong <SCRIPT/> tag formatting

  •  11-22-2011, 8:04 AM

    Re: Wrong <SCRIPT/> tag formatting

    Hi Ken,

     

    Everything is correct, except of the script you're trying to enter.

    The problem is that if the script has multiple lines of code, after you restore it with setHTML(),

    it will be put into one single line. Except of bad readability, if the script contains comments which

    start from //, the script will be distorted – all the script lines after // will be commented.

    Try to put the following script into your HTML:

     

    <SCRIPT>

        function test() // simply a test function

         { alert("Hello!");

         }

     </SCRIPT>

     

    You’ll see that after calling setHTML() you’ll get something like this:

     

    <SCRIPT>        function test() // simply a test function        { alert("Hello!");        }     </SCRIPT>

     

    As you understand, this code is not valid.

     

    Thanks,

     

    Herev

View Complete Thread