在JS里,要使用\须进行转义
如:
alert("test\\test")

解决方案 »

  1.   

    谢谢孟子章,document.location还有什么属性,请指教
    分数不够再给
      

  2.   

    <script>
    document.write("以下列出document.location的所有属性<br>")
    for(a in document.location)
       document.write(a + "<br>")
    document.write("更详细的参见http://www.msdn.com")
    </script>运行以上代码看看
      

  3.   

    window.location.href="xxx/ss.htm";
    document.location也是正确的,它返回文档的location对象
      

  4.   

    location属于window和document对象,但location 对象的属性是一下的,用法上没有什么差别
      

  5.   

    [http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_location.asp]:
    ___________________________________________________________________
    Property | Description 
    ---------------------------------------------------------------
    hash     | Sets or retrieves the subsection of the href property that follows the number sign (#). 
    ---------------------------------------------------------------
    host     | Sets or retrieves the hostname and port number of the location or URL. 
    ----------------------------------------------------------------
    hostname | Sets or retrieves the host name part of the location or URL.  
    ----------------------------------------------------------------
    href     | Sets or retrieves the entire URL as a string.  
    ----------------------------------------------------------------
    pathname | Sets or retrieves the file name or path specified by the object.  
    ----------------------------------------------------------------
    port     | Sets or retrieves the port number associated with a URL. 
    ----------------------------------------------------------------
    protocol | Sets or retrieves the protocol portion of a URL.  
    ----------------------------------------------------------------
    search   | Sets or retrieves the substring of the href property that follows the question .  
    ----------------------------------------------------------------