I. Browser Capabilities Components
The main function of this component is to extract and identify the version information of the client browser.
The principle is as follows: when the client browser sends a page request to the server, a User Agent HTTP title is automatically sent, which is an ASCII string that declares the browser and its version. The Browser Capabilities component maps the User Agent to the Browser specified in the Browscap. ini file, and identifies the client Browser through the BrowserType object attributes.
If the item matching the title cannot be found in the browscap. ini file, the default browser attribute is used. If no match is found for this object and the default browser settings are not specified in the browscap. ini file, it sets each attribute to the string "UNKNOWN ".
By default, browscap. the INI file is stored in the WINDOWS \ SYSTEM \ INERSRV (for example, 95/98 + PWS4) or NT \ SYSTEM32 \ INERSRV (for example, NT) directory. You can edit the text file by yourself, to add your own properties or modify the file based on the latest browser version Update file.
It can be concluded that the Browser Capabilities component extracts the content of a file and then compares the content to display it. How should I apply it?
1, btinfo. asp
<% Set bc = server. CreateObject ("mswc. browsertype") %> The browser name is browser: <% = bc. browser %> <br> The browser version is version: <% = bc. version %> <br> The main version of the browser is majorver: <% = bc. majorver %> <br> The auxiliary browser version is minorver: <% = bc. minorver %> <br> The operating platform of the browser is platform: <% = bc. platform %> <br> |
Obviously, "<% set bc = server. CreateObject (" mswc. browsertype ") %>" is the creation of browser components.
The following example shows a specific feature of the browser, such as "bc. browser.
2, btif. asp
<% Set bc = server. CreateObject ("mswc. browsertype") %> <% If bc. frames = true then %> The browser supports multi-window (frames) display. <% Else %> The browser does not support multi-window (frames) display. <% End if %> <Br> <% If bc. backgroundsounds = true then %> The browser can play background music (backgroundsounds) <% Else %> The browser cannot play background music (backgroundsounds) <% End if %> <Br> <% If bc. tables = true then %> The browser supports table display. <% Else %> The browser does not support table display. <% End if %> <Br> <% If bc. beta = true then %> Your browser is a beta version) <% Else %> Your browser is in the official version. <% End if %> <Br> <% If bc. activexcotrols = true then %> Browser supports active control <% Else %> The browser does not support active control. <% End if %> <Br> <% If bc. cookies = true then %> The browser supports the cookie function. <% Else %> The browser does not support the cookie function. <% End if %> <Br> <% If bc. vbscript = true then %> The browser supports vbscript <% Else %> The browser does not support vbscript. <% End if %> <Br> <% If bc. jscript = true then %> Browser support for jscript <% Else %> The browser does not support jscript. <% End if %> |
This code is used to check the current browser's support for various types of web technologies, then the following can be changed according to a specific situation
3. fram. asp
<% Set bc = server. CreateObject ("mswc. browsertype ") If bc. frames then %> <Frameset rows = "*, *"> <Frame src = "http://www.google.com"> <Frame src = "http://www.baidu.com"> </Framest> <% Else %> Your browser does not support the framework. <% End if %> |
Very simple: if the current browser supports the framework, the frameset is displayed; otherwise, the prompt "your browser does not support the framework" is displayed"
Of course, you should be reminded not to rely too much on this component, because it only extracts browscap. ini, and the value can be modified by the customer at any time, or the record is outdated, and cannot actually reflect the situation in the browser. Use it with caution.
Ii. Content Linking component
Once we used DW for Web pages, we had the trouble: when we made a new page, we had to re-create a hyperlink for all other related pages. Once, I felt that I had done a lot of useless work. Imagine how nice it would be to have a special file responsible for page connection.
The Content Linking component came into being. It not only allows you to create a directory table on these pages, but also allows you to establish a dynamic connection between them, and automatically generate and update the directory table and the navigation links of the previous and subsequent Web pages.
To use this component, you must first compile a directory file, that is, the sequential list file of the Web site URL. It is a text file and can be freely named. Next, compile an ASP file and automatically generate a directory page with a hyperlink based on the information provided by the directory file. If you want to create a hyperlink for each page, you can write a file that can automatically generate a hyperlink. For example, "Nlink. inc ". Later, it will be included in each page of the group.
1. link.txt
Redirect. asp? URLs = http://www.cnbruce.com/cnbruce.com Redirect. asp? Url = http://www.blueidea.com/blueidea.com Redirect. asp? URLs = http://www.it365cn.com/it365cn.com |
The URL of the directory file is the link URL, and the text is the link text. Note thatTab key.
2, link. asp
<% Set objNextLink = Server. CreateObject ("MSWC. Nextlink") %> <% IntCount = objNextLink. GetListCount ("link.txt ") For I = 1 To intCount %> <A href = "<% = objNextLink. GetNthURL (" link.txt ", I) %>"> <% = ObjNextLink. GetNthDescription ("link.txt", I) %> </A> <Br> <% Next %> |
"Set objNextLink = Server. CreateObject ("MSWC. Nextlink ")Create a connection to the Nextlink component
"ObjNextLink. GetListCount ("link.txt ")Number of lists extracted from the link.txt file by DIG
"ObjNextLink. GetNthURL ("link.txt", I)Extract the URL of line I text in the link.txt File
"ObjNextLink. GetNthDescription ("link.txt", I)Extract the connection text of line I in the link.txt File
3. redirect. asp
That is, to switch to the file.
<% Response. Clear Response. Redirect Request. QueryString ("url ") %> |
Haha, do you think the "Previous Page" and "next page" functions are useless. Come back ~!
4,link1.txt
1. advanced asp programming (1) 2. advanced asp programming (2) 3. advanced asp programming (3) 4. advanced asp programming (4) |
The main function is to set text and Connection
5, link1.inc
<% Set Nextlink = Server. CreateObject ("MSWC. NextLink ") Response. write "the index number of the current article is" & NextLink. GetListIndex ("link1.txt") & "<br>" Response. write "the title of the previous chapter:" & NextLink. getpreviusdescription ("link1.txt") & "<br>" Response. write "the title of the next chapter:" & NextLink. GetNextDescription ("link1.txt") & "<br>" Count = NextLink. GetListCount ("link1.txt ") Response. write "<a href =" "& NextLink. getNthUrl ("link1.txt", 1) & "" &> "&" Chapter 1 "&" </a>" Response. write "<a href =" "& NextLink. getpreviusurl (" link1.txt ") &" "&>" & "previous chapter" & "</a>" Response. write "<a href =" "& NextLink. GetNextUrl (" link1.txt ") &" "&>" & "Next Chapter" & "</a>" Response. write "<a href =" "& NextLink. getNthUrl ("link1.txt", count) & "" &> "&" last chapter "&" </a> <br>" %> |
GetListCount (target file name) displays the number of connected files in the component. GetListIndex (target file name) displays the index values of the current page before and after these connection files. GetNextDescription (target file name) displays the next description in the connection file. GetNextURL (target file name) displays the URL of the next file in the connection file. GetNthDescription (target file name, N) displays the description of the N web pages in the connection file. GetNthURL (target file name, N) displays the File URL address of the nth web page in the connection file. Getpreviusdescription (target file name) displays the description of the previous file in the connection file. Getpreviusurl (target file name) displays the URL of the previous file in the connection file. |
6, 1.asp, 2.asp, 3.asp, 4.asp
<! -- # Include file = "link1.inc" --> <br> The following content |
Is a simple paging program. Of course there will be more detailed and complex pages later. Come on, huh, huh.