Syntaxdocument.write(sText)
ParameterssText Required. String that specifies the text and HTML tags to write. Return ValueNo return value.ResYou should not use the write or writeln methods on the current document after the document has finished loading unless you first call the open method, which clears the current document's window and erases all variables.Note  When document.write or document.writeln is used in an event handler, document.close should also be used.
Standards InformationThis method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 . 

解决方案 »

  1.   

    你的问题在于你一定是用鼠标双击了位于磁盘上的html文件,那是看不到document.domain和document.referrer的。比如你的文件可能是这样的
    a.html
    ----------------------------------------------------
    <html>
    <script language="JavaScript">
    document.write("<p>Here’s some information about this document:</p>");
    document.write("<ul>");
    document.write("<li>Referring Document: " +document.referrer + "</li>");
    document.write("<li>Domain: " + document.domain +"</li>");
    document.write("<li>URL: " + document.URL + "</li>");
    document.write("</ul>");
    </script>
    <body>
    </body>
    </html>
    ----------------------------------------------------
    其中,
    document.referrer:
    表示是从哪个页面链接到本页面上来的,
    比如,如果在http://www.163.com上有个链接指向你的a.html,那么,当从http://www.163.com上点击该链接打开你的a.html时,你的那个document.referrer就有值了,是http://www.163.com,因此,这个属性字段通常是用来判断自己的页面是从哪里被打开的。
    docunment.domain:
    这个是得到当前的域名字,比如:http://localhost/a.html,那么document.domain就是localhost要看document.domain吗?
    把你的a.html放到你的web服务器的目录下,你用的什么web服务器,iis还是apache,如果你不了解这个,那建议你就干脆不要看document.domain和document.rerferrer了:)
    放好后,打开一个新的ie浏览器,在地址栏输入url,如果不知道输入什么,那也作罢吧。看到document.domain了!那再看document.referrer吧,怎么看?
    再写个b.html
    b.html
    -------------------------------------
    <html>
    <body>
    <a href=a.html>到a上去看看</a>
    </body>
    </html>
    --------------------------------------把b.html也放到你的web服务器目录上,和a.html在相同的目录下,通过浏览器输入b.html的url,点击上面的超链接
      

  2.   

    好像不像codeworker999(勿把原因当理由)这位朋友所说的
    是后面的覆盖了前面????????
      

  3.   

    谢谢FuWaer() ,我理解你的意思啦,太谢谢你啦!多给你点分数