ASP programming introduction (fourteenth): browser & linking

xiaoxiao2021-03-06  41

Browser Capabilities Components The main role of this component is to extract the version information of the recognition client browser. The principle is such that when the client browser sends a page request to the server, a USER Agent HTTP title is automatically sent, and the title is a declarative browser and its version ASCII string. Browser Capabilities components map the user agent to the browser indicated in the file browscap.ini, and identify the customer browser through the properties of the Browsertype object. If the object does not find items matching with the title in the browscap.ini file, the default browser properties will be used. If the object does not find a match and the default browser settings are not specified in the browscap.ini file, it sets each attribute to a string "unknown". By default, the browscap.ini file is stored in Windows / System / INERSRV (if it is 95/98 pws4) or NT / System32 / INERSRV (if it is NT) directory, you can edit this text file yourself to add Your own properties or modify the file based on the updated file of the latest browser version. It can be concluded that the Browser Capabilities components are also extracted in a file and then compare the display. How do you apply? 1, btinfo.asp

<% set bc = server.createObject ("mswc.browsertype")%> browser name is Browser: <% = bc.browser%>
browser version is Version: <% = bc.version%>
Browser main versions are Majorver: <% = bc.majorver%>
Browser secondary version is minorver: <% = bc.minorver%>
The running platform of the browser is Platform: <% = BC. Platform%>

Obviously "<% SET BC = Server.createObject (" Mswc.BrowSertype ")%>" is the establishment of the browser component, such as "BC.Browser", is a specific feature of displaying the browser. 2, btif.asp

<% set bc = server.createObject ("mswc.browsertype")%> <% if bc.frames = true kil> browser supports multi-window (frames) display <% else%> Browser does not support multi-window (Frames <<% END IF%>
<% if bc.backgroundsounds = true kil> browser can play background music (Backgroundsounds) <% ELSE%> Browser can not play background music (Backgroundsounds) <% end IF% >
<% if bc.tables = true the%> Browser Support Table (Tables) Display <% ELSE%> Browser Not Supported <% END IF%>
<% IF BC .berta = true kil> Your browser is a test version (beta) <% else%> Your browser is a forma version <% end if%>
<% if bc.activexcotrols = true kil > Browser Support Active Control <% ELSE%> Browser does not support ACTIVE control <% end if%>
<% if bc.cookies = true life%> Browser supports cookie function <% else%> Browser Support cookie function <% end if%>
<% if bc.vbscript = true life%> Browser supports VBScript <% else%> Browser does not support VBScript <% end if%>
<% IF BC .jscript = true life%> Browser supports JScript <% else%> Browser does not support JScript <% end if%> This code is to detect the support of all kinds of web technology for all kinds of web technology, then according to certain Performance to change 3, FRAM.ASP

<% set bc = server.createObject ("mswc.browsertype") if bc.frames kil> <% else%> Your browser does not support framework <% end if%>

Very simple meaning: If the current browser supports the framework, the Frameset display is performed, otherwise prompts "Your browser does not support the framework" Of course, you need to remind you: Don't rely over, because it just extracts browscap.ini Value, and this value can be modified by customers, or record it, it cannot be true to the situation of the browser, caution. Second, the Content Linking component has used a DW to do a web page: new page, all other related pages must be re-made once a hyperlink. Once, I will have a lot, I can't help but feel a lot of work. Imagine if there is a special file to be responsible for the page connection. The Content Linking component is also gone. It doesn't make you create a directory table in these pages, and you can also create dynamic connections in them, and automatically generate and update the directory table and the previous and subsequent web pages navigation links. Using this component, you first need to write a directory file, which is the order list file of the web address, which is a text file and can be named freely. Second, write an ASP file, automatically generate a chain directory page according to the information provided by the directory file. If you need a "forward or back page" overhead, you can write an architecture file that automatically generates a page chain, you can use INC as an extension, such as "nLink.inc". In the future, it contains it in each page in the group. 1, LINK.TXTREDIRECT.ASP? URL = http://www.cnbruce.com/ cnbruce.comredirect.asp? URL = http://www.blueidea.com/ Blueidea.comRedirect.asp? URL = http: // Www.it365cn.com/ it365cn.com

The URL of the directory file is the connection URL. The text is a connection text, and it is necessary to note that the intermediate is separated by the Tab key. 2, Link.asp

<% Set objnextLink = server.createObject ("mswc.nextLink")%> <% intcount = objnextLink.getlistcount ("link.txt") for i = 1 to intcount%> > <% = ObjnextLink.getNTHDESCRIPTION ("Link.txt", I)%>
<% Next%>

"Set ObjnextLink = Server.createObject (" Mswc.nextLink ")" Establishing the connection of NextLink Components "ObjnextLink.getListCount (" Link.txt ")" ObjnextLink.getnthurl "ObjnextLink.getnthurl (" Link.txt " ", i)" Extract the connection URL "ObjnextLink.GetNTHDESCRIPTION (" Link.txt ", i)" in the link.txt file "ObjnextLink.GetNTHDESCRIPTION (" Link.txt ", i)" ObjnextLink.getNTHDESCRIPTION ("LINK.TXT", I) to extract the text 3, Redirect.asp That is to turn to the file.

<% Response.clearresponse.redirect request.QueryString ("URL")%>

Oh, is it really useless to "Previous", "Next" function. Come ~! 4, LINK1.TXT1.ASP ASP Programming Introduction (1) 2.ASP ASP Programming Introduction (2) 3.ASP ASP Programming Introduction (3) 4.ASP ASP Programming Introduction (4)

The main function is to set text and connection 5, link1.inc

<% Set nextlink = server.createObject ("mswc.nextlink") response.write "Current article index number" & nextLink.getListIndex ("link1.txt") & "
" response.write "last chapter Title: "& nextLink.getPReviousDescription (" Link1.txt ") &"
"Response.write" Next chapter: "& nextLink.getNextDescription (" link1.txt ") &"
"count = NextLink.getListCount ("Link1.txt") response.write " "response.write" " response.write "&" Next chapter "&" "response.write "&" The last chapter "&"
"%>

GetListCount displays the number of files that are included in the component. GetListIndex displays the front-rear position index value of the current page in these connection files. GetNextDescription Displays the next description of the connection file. GetNextURL Displays the URL address of the next file in the connection file. GetNTHDESCRIPTION (Target File Name, N) Displays a description of the Nth page in the connection file. GetNThurl (target file name, n) displays the file URL address of the Nth page in the connection file. GetPReviousDescription (Target File Name) Displays a description of the previous file in the connection file. GetPreviousURL (Target File Name) Displays the URL address of the previous file in the connection file. 6, 1.asp, 2.asp, 3.asp, 4.asp


The following is the specific content

It is a very simple paging program. Of course, then there will be some more detailed and more complex paging, come slowly, huh, huh.

转载请注明原文地址:https://www.9cbs.com/read-70356.html

New Post(0)