What does this mean: "document.write('<scr'+'ipt... "?
html, javascript
Solution
Consider this simplified example:
<script>
document.write("something </script> something");
</script>
The browser's HTML parser would see the `</script>` within the JavaScript string and interpret that as the end of the script element.
The HTML parser doesn't know about JavaScript syntax - all it knows is that the `<script>` element ends at the next `</script>`.
(It also knows that you can't have nested `<script>` elements, hence the breaking of the opening `<script>` as well as the closing `</script>` in your example.)
Problem
I've seen this on every Yahoo! news page, at the bottom of the source code, and failed to understand why they break the script word like that. Does anybody know if there's any reason for this? ``` document.write("<scr"+"ipt language=javascript src=http://l.yimg.com/d/lib/bc/bc_2.0.4.js></scr"+"ipt>"); ```