Sometimes we need to get the url of the current webpage for our judgment. Generally, we use location. href to get the js url link string: location. href
It can be intercepted to obtain the transmission parameters, which are commonly used as follows:
Location. href. indexOf ("? ") ------ Get? Index value.
Note: The location. href here is not the address in the current address bar, but the actual address of the page.
In addition, there are some additional questions:
In C #, the index of the character location is also obtained using IndexOf.
Obtaining indexes in SQL Server is different:
First:
Select * from dbo. users where CharIndex ('2', mainsubjects)> 0
Second:
Select * from dbo. users where patIndex ('% 100', mainsubjects)> 0
I used to determine whether the advertisement should be displayed by judging the column:
The advertisement is displayed only at http://www.jb51.net/codes/contents:
The Code is as follows:
If (location. href. indexOf ("http://www.jb51.net/codes/")>-1 ){
Alert ('OK ');
}