/* -- Get the parameter passed by the webpage -- */function request (paras) {var url = location. href; var parastring = URL. substring (URL. indexof ("? ") + 1, URL. length ). split ("&"); var paraobj = {} for (I = 0; j = parastring [I]; I ++) {paraobj [J. substring (0, J. indexof ("= ")). tolowercase ()] = J. substring (J. indexof ("=") + 1, J. length);} var returnvalue = paraobj [paras. tolowercase ()]; If (typeof (returnvalue) = "undefined") {return ";} else {return returnvalue;} You can call this request, here you can call request ("ID ")
Jquery obtains the URL Information of the current page
To improve the user experience, you need to highlight the category of the current page in the navigation menu to let users know where they are currently on the website. I have been modifying the content in the program for a long time, so I am very troublesome. I thought about whether I can use jquery to obtain the URL of the current page to achieve this effect. Of course, the answer is yes.
Most importantlyObtain the details of the current URL, You can determine, this requires the useFunctions of jquery to obtain a URL. I would like to share with you that some friends who have never used this method can try it.
Sets or obtains the specified file name or path of an object. Window. Location. pathname
Set or retrieve the entire URL as a string. Window. Location. href
Set or obtain the port number associated with the URL. Window. Location. Port
Set or obtain the protocol section of the URL. Window. Location. Protocol
Set or obtain the segment following the # In the href attribute. Window. Location. Hash
Set or obtain the hostname and port numbers of the location or URL. Window. Location. Host
Set or obtain the Section following the question mark in the href attribute. Window. Location. Search
Window. Location
Attribute |
Description |
Hash |
Set or get Segment following the # In the href attribute. |
Host |
Set or obtain the hostname and port numbers of the location or URL. |
Hostname |
Set or obtain the Host Name of the location or URL. |
Href |
Set or retrieve the entire URL as a string. |
Pathname |
Sets or obtains the specified file name or path of an object. |
Port |
Set or obtain The port number associated with the URL. |
Protocol |
Set or obtain the protocol section of the URL. |
Search |
Set or obtain the Section following the question mark in the href attribute. |