Javascript obtains the parameters of the get method.

Source: Internet
Author: User
  1. <SCRIPT>
  2. Url = location. Search. substr (1 );
  3. If(URL. length> 0)
  4. {
  5. AR = URL. Split (/[& =]/);
  6. For(I = 0; I <ar. length; I + = 2)
  7. {
  8. Alert ("Parameter :"+ Ar [I] +":"+ Ar [I + 1] +"<Br>");
  9. }
  10. }
  11. </SCRIPT>
    1. <A Href='? A = Hello & Room = awe'>Test</A>

Parameter reference
Window. Location
Set or obtain the segment following the # In the href attribute in the hash.
Host sets or obtains the hostname and port numbers of the location or URL.
Set the hostname or obtain the Host Name of the location or URL.
Href sets or retrieves the entire URL as a string.
Set or retrieve the specified file name or path of the object.
Set or obtain the port number associated with the URL.
The protocol that sets or retrieves a URL.
Search sets or obtains the content following the question mark in the href attribute.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.