The following html will output nothing on html page, you may meet it before.
<html> <head> <title>Tmp HTML</title> <script type="text/javascript"> document.write(String.fromCharCode(0x204A)); </script> </head> <body> </body> </html>
Why nothing displayed? It is because bothdocument.write
anddocument.writeln
method output text into an
unready (open) document. That is to say, When the page finishes loading, the document becomes
closed. An attempt to document.write
in it will cause the contents to be erased.
You can work around as following:
<html> <head> <title>Tmp HTML</title> <script type="text/javascript"> function MyDocumentWrite() { document.write(String.fromCharCode(0x204A)); } window.onload = MyDocumentWrite; </script> </head> <body> </body> </html>