javascript手冊-s1[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 longj 的 blog

 

search property

a string beginning with a question mark that specifies any query information in the url.

语法

1. links[index].search
2. location.search

index is an integer representing a link object.

property of

link, location

描述

the search property specifies a portion of the url.

you can set the search property at any time, although it is safer to set the href property to change a location. if the search that you specify cannot be found in the current location, you will get an error.

see section 3.3 of rfc 1738 for complete information about the search.

例子

in the following example, the window.open statement creates a window called newwindow and loads the specified url into it. the document.write statements display all the properties of newwindow.location in a window called msgwindow.

newwindow=window.open
   ("http://guide-p.infoseek.com/ww/ns/titles?qt=rfc+1738+&col=ww")

msgwindow.document.write("newwindow.location.href = " +
   newwindow.location.href + "<p>")
msgwindow.document.write("newwindow.location.protocol = " +
   newwindow.location.protocol + "<p>")
msgwindow.document.write("newwindow.location.host = " +
   newwindow.location.host + "<p>")
msgwindow.document.write("newwindow.location.hostname = " +
   newwindow.location.hostname + "<p>")
msgwindow.document.write("newwindow.location.port = " +
   newwindow.location.port + "<p>")
msgwindow.document.write("newwindow.location.pathname = " +
   newwindow.location.pathname + "<p>")
msgwindow.document.write("newwindow.location.search = " +
   newwindow.location.search + "<p>")
msgwindow.document.write("newwindow.location.hash = " +
   newwindow.location.hash + "<p>")
msgwindow.document.close()

the previous example displays the following output:

newwindow.location.href =
   http://guide-p.infoseek.com/ww/ns/titles?qt=rfc+1738+&col=ww
newwindow.location.protocol = http:
newwindow.location.host = guide-p.infoseek.com
newwindow.location.hostname = guide-p.infoseek.com
newwindow.location.port = 
newwindow.location.pathname = /ww/ns/titles
newwindow.location.search = ?qt=rfc+1738+&col=ww
newwindow.location.hash = 

相关

  • hash, host, hostname, href, pathname, port, protocol properties

    select method

    selects the input area of the specified password, text, or textarea object.

    语法

    1. passwordname.select()
    2. textname.select()
    3. textareaname.select()
    

    passwordname is either the value of the name attribute of a password object or an element in the elements array.
    textname is either the value of the name attribute of a text object or an element in the elements array.

  • 本文关键:javascript
      相关方案
    Google
     

    本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

    go top