国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

ASP教程 / ASP Content Linking

ASP Content Linking


tryitimg.gif

嘗試一下 - 實例

Content Linking 組件
本例構(gòu)建一個內(nèi)容列表。

Content Linking 組件 2
本例使用 Content Linking 組件在一個文本文件所列的頁面間進(jìn)行導(dǎo)航。


ASP Content Linking 組件

ASP Content Linking 組件用于創(chuàng)建快捷便利的導(dǎo)航系統(tǒng)!

Content Linking 組件會返回一個 Nextlink 對象,這個對象用于容納需要導(dǎo)航網(wǎng)頁的一個列表。

語法

<%
Set nl=Server.CreateObject("MSWC.NextLink")
%>


ASP Content Linking 實例

首先,我們會創(chuàng)建一個文本文件 - "links.txt":

asp_intro.asp ASP 簡介
asp_syntax.asp ASP 語法
asp_variables.asp ASP 變量
asp_procedures.asp ASP 程序

上面的文本文件包含需要導(dǎo)航的頁面。頁面的排列順序應(yīng)該與它們的顯示順序相同,并包含對每個文件名的描述(使用制表符來分隔文件名和描述信息)。

注釋:如果您希望向列表添加頁面,或者改變在列表中的頁面順序,那么您需要做的僅僅是修改這個文本文件而已!導(dǎo)航會自動更新!

然后我們創(chuàng)建一個引用文件,"nlcode.inc"。.inc 文件創(chuàng)建一個 NextLink 對象來在 "links.txt" 中列出的頁面間進(jìn)行導(dǎo)航。

"nlcode.inc":

<%
dim nl
Set nl=Server.CreateObject("MSWC.NextLink")
if (nl.GetListIndex("links.txt")>1) then
Response.Write("<a href='" & nl.GetPreviousURL("links.txt"))
Response.Write("'>Previous Page</a>")
end if
Response.Write("<a href='" & nl.GetNextURL("links.txt"))
Response.Write("'>Next Page</a>")
%>

請在文本文件 "links.txt" 列出的每個 .asp 頁面中放置一行代碼:<!-- #include file="nlcode.inc"-->。這行代碼會在 "links.txt" 中列出每個頁面上引用 "nlcode.inc" 中的代碼,這樣導(dǎo)航就可以工作了。


ASP Content Linking 組件的方法

方法描述實例
GetListCount返回內(nèi)容鏈接列表文件中所列項目的數(shù)量。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListCount("links.txt")
Response.Write("There are ")
Response.Write(c)
Response.Write(" items in the list")
%>

輸出:

There are 4 items in the list

GetListIndex返回在內(nèi)容鏈接列表文件中當(dāng)前條目的索引號。第一個條目的索引號是 1。如果當(dāng)前頁面不在內(nèi)容鏈接列表文件中,則返回 0。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

輸出:

Item number 3

GetNextDescription返回在內(nèi)容鏈接列表文件中所列的下一個條目的文本描述。如果在列表文件中沒有找到當(dāng)前文件,則返回列表中最后一個頁面的文本描述。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextDescription("links.txt")
Response.Write("Next ")
Response.Write("description is: ")
Response.Write(c)
%>

輸出:

Next description is: ASP Variables

GetNextURL返回在內(nèi)容鏈接列表文件中所列的下一個條目的 URL。如果在列表文件中沒有找到當(dāng)前文件,則返回列表中最后一個頁面的 URL。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextURL("links.txt")
Response.Write("Next ")
Response.Write("URL is: ")
Response.Write(c)
%>

輸出:

Next URL is: asp_variables.asp

GetNthDescription返在內(nèi)容鏈接列表文件中所列的第 N 個頁面的描述信息。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthDescription("links.txt",3)
Response.Write("Third ")
Response.Write("description is: ")
Response.Write(c)
%>

輸出:

Third description is: ASP Variables

GetNthURL返回在內(nèi)容鏈接列表文件中所列的第 N 個頁面的 URL。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthURL("links.txt",3)
Response.Write("Third ")
Response.Write("URL is: ")
Response.Write(c)
%>

輸出:

Third URL is: asp_variables.asp

GetPreviousDescription返回在內(nèi)容鏈接列表文件中所列的前一個條目的文本描述。如果在列表文件中沒有找到當(dāng)前文件,則返回列表中第一個頁面的文本描述。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousDescription("links.txt")
Response.Write("Previous ")
Response.Write("description is: ")
Response.Write(c)
%>

輸出:

Previous description is: ASP Variables

GetPreviousURL返回在內(nèi)容鏈接列表文件中所列的前一個條目的 URL。如果在列表文件中沒有找到當(dāng)前文件,則返回列表中第一個頁面的 URL。<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousURL("links.txt")
Response.Write("Previous ")
Response.Write("URL is: ")
Response.Write(c)
%>

輸出:

Previous URL is: asp_variables.asp