Home >Web Front-end >JS Tutorial >JS gets the url link string location.href_basic knowledge
js to obtain the url link string: location.href
can intercept it to obtain the transmitted parameters. Commonly used are as follows:
location.href.indexOf("?")--- ---Get? index value.
Note: The location.href here does not refer to the current address in the address bar, but the actual address of the page.
In addition, some digressions:
In C#, IndexOf is also used to obtain the index of the character position.
Getting the index in sqlserver is different:
The first one:
select * from dbo.users where CharIndex('2',mainsubjects)>0
The second method:
select * from dbo.users where patIndex('%2%',mainsubjects)>0
I use the judgment column to determine whether the advertisement should be displayed :
Only content in the http://www.jb51.net/codes/ directory will display ads: