JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

15.10.1 Document Properties

15.10.1 Document Properties


This chapter has already introduced Document properties such as body, documentElement, and forms that refer to special elements of the document. Documents also define a few other properties of interest:

cookie

A special property that allows JavaScript programs to read and write HTTP cookies. This property is covered in Chapter 20 .

domain

A property that allows mutually trusted web servers within the same Internet domain to collaboratively relax same-origin policy security restrictions on interactions between their web pages (see §13.6.2.1 ).

lastModified

A string that contains the modification date of the document.

location This property refers to the same Location object as the location property of the Window object.

referrer

The URL of the document containing the link, if any, that brought the browser to the current document. This property has the same content as the HTTP Referer header, but it is spelled with a double r.

title The text between theandtags for this document. URL

The URL of the document as a read-only String rather than as a Location object. The value of this property is the same as the initial value of location.href, but it is not dynamic like the Location object is. If the user navigates to a new fragment identifier within the document, for example, location.href will change, but document.URL will not.

referrer is one of the most interesting of these properties: it contains the URL of the document from which the user linked to the current document. You might use this property with code like this:

if (document.referrer.indexOf("http://www.google.com/search?") == 0) { var args = document.referrer.substring(ref.indexOf("?")+1).split("&"); for(var i = 0; i < args.length; i++) {

if (args[i].substring(0,2) == "q=") {

15.10 Other Document Features | 405

document.write("

Welcome Google User. "); document.write("You searched for: " + unescape(args[i].substring(2)).replace('+', ' '); break; } } }

欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/31438.html
友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1