JS get URL link string: location.href
It can be intercepted to obtain the transmitted parameters, which are commonly used as follows:
Location.href.indexOf ("?") ------Get it? The index value.
Note: The location.href here is not the address in the Address bar now, but the actual address of the page.
In addition, some digression:
The index in C # that gets the location of the character is also obtained by indexof.
Getting an index in SQL Server is different:
First type:
SELECT * from Dbo.users where CharIndex (' 2 ', mainsubjects) >0
The second type:
SELECT * from Dbo.users where PatIndex ('%2% ', mainsubjects) >0
I use the Judge column to determine whether the advertisement should be displayed:
Only the contents of the http://www.jb51.net/codes/directory display ads:
Copy Code code as follows:
if (Location.href.indexOf ("http://www.jb51.net/codes/") >-1) {
Alert (' OK ');
}