ASP橫幅廣告系統(tǒng)外文翻譯_第1頁(yè)
ASP橫幅廣告系統(tǒng)外文翻譯_第2頁(yè)
ASP橫幅廣告系統(tǒng)外文翻譯_第3頁(yè)
ASP橫幅廣告系統(tǒng)外文翻譯_第4頁(yè)
ASP橫幅廣告系統(tǒng)外文翻譯_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、asp banner ad systemto the reader from joe:this is a user-submitted tutorial by the author above. i have read the tutorial and set the format to fit html goodies, but for the most part have not changed the language. i chose this tutorial because many readers have been asking for more asp tutorials.

2、this is a great one.sorry i cannot show you the event here. the html goodies servers do not offer asp. i will tell you though that if you run ie5.0 or better, open the contents of the zip file into a directory and it runs just fine.if you havent already, you may want to read my introductoryasp tutor

3、ialbefore this one. if not, then enjoy. there may be a point in your web design career, where your site becomes real popular. that is when companies become interested in advertising on your site. a banner ad system can be built to control all those advertisements that you are so willing to display,

4、for a price. active server pages makes it very easy to create a banner ad system. so easy, that the microsoft asp developers created an adrotator component for the occasion. before you begin reading this article, make sure you download the support material below.the files included aread.txtbanner.as

5、p3 banner imagesclicks.aspexample.aspredirect.aspad.txtin order for the adrotator component to work, you must configure a text file. this text file contains all the banner ad properties. however, the text file must follow a certain format. the first four lines are as follows:redirect redirect.aspwid

6、th 400height 50*redirectwhen a banner is clicked, the adrotator component goes to a preliminary page. this page is called a redirect page. the redirect page handles any extra programming events before directing a user to the banners destination. in this example banner system, i called the preliminar

7、y file redirect.asp.widththis sets the width of the banner ad image. the value must be in pixels.heightthis sets the height of the banner ad image. the value must be in pixels.*the asterisk tells the adrotator component that it is about to acquire banner ad information. the asterisk is required.once

8、 you define the general properties above the asterisk, then comes the list of banners to display. in thead.txtfile, there are three banners defined below the asterisk.banner1.jpghtmlg20banner2.jpgy30banner3.jpgd30each banner requires four lines of properties, which follow the format below:image file

9、nameweb address descriptionbanner weightimage filethe image filename can be a fully qualified web address or relative name that points to the image. if the image is in a different folder, then you also include the folder name as well.( banner1.jpg, or foldername/banner.jpg)web addressthe web address

10、 can be a page on your site or a fully qualified web address that leads to another site.descriptionthe description will be displayed as a tool tip. when you rest your mouse over the banner, the description pops up.banner weightthe banner weight determines how much a banner is displayed. the adrotato

11、r component adds all of the banner weights and determines the probability or percent chance of a particular banner being displayed. a banner with a higher weight has better a better probability.note:you can disable a banners property by substituting with a dash.banner3.jpg-d30the example entry above

12、 would create a banner ad that does not have a web address.banner.aspthis file uses the adrotator component and analyzes the contents of the ad.txt file. below is the code.sub banner(strtarget)dim bannerad, htmlset bannerad = server.createobject(mswc.adrotator)bannerad.targetframe = strtargethtml =

13、bannerad.getadvertisement(ad.txt)response.write htmlend subthe first thing to note is that the asp was written with vbscript. the second thing to note is that the code is written inside a sub procedure calledbanner(strtarget).for those of you who do not know, a sub procedure allows you to group toge

14、ther a bunch of code that can be reused over and over. like a function, it takes an argument, such as a word or variable. in the code above the argument is strtarget.unlike a function, a sub-procedure does not return any values, it just executes the code inside line by line.inside the sub i declare

15、two variables.dim bannerad, htmlnext i store the adrotator component inside the bannerad variable. when storing a component inside a variable you use the set keyword. since we are programming server-side with asp, we use server.createobject to summon the component. mswc.adrotator is the component ke

16、y or name value.set bannerad = server.createobject(mswc.adrotator)next i use a property of the adrotator called targetframe. this property is equivalent to:the target-value can be one of the values below:_blankopens the destination link in a new browser window._topopens the destination link on top o

17、f the web page._parentopens the destination link within a parent frame._newopens the destination link in a new browser window.next, i use an adrotator method or function called getadvertisement and stored its results in the html variable. notice that the getadvertisement takes the name of the ad ban

18、ner text file as an argument.html = bannerad.getadvertisement(ad.txt)finally, i want to print the contents of the html variable. this prints the code that displays the banner images.response.write htmlredirect.aspthis is the file that is processed before someone is redirected to the banners web addr

19、ess. inside this file, we can capture information like how many times a particular banner is clicked and so on. to start things off, i defined a variable called strurl.dim strurlnext i store a querystring value inside this new variable.strurl = request.querystring(url)a querystring is nothing more t

20、han a bunch of name/value pairs attached to a web address. when a user clicks on a banner, the adrotator component attaches a querystring to the redirect file. so if we were to click banner1.jpg, defined in ad.txt, we would end up with a redirect web address that looks like so.redirect.asp?url=&imag

21、e=banner1.jpgin essence assigning request.querystring(url) to strurl, is the same as assigning to it.finally, i check to see which banner was clicked. i accomplish this with the vbscript instr( ) function.if instr(strurl, htmlgoodies) then application.lockapplication(htmlgoodies) = application(htmlg

22、oodies) + 1application.unlockresponse.clearresponse.redirect strurlend ifthe instr( ) function returns the number position of a sub-word (sub-string) within another word (string). the format is as followsinstr(main word, sub-word)if the sub-word exist within the main word, then the function will equ

23、al a number greater-than zero or true. if the sub-word does not exist, then the function will equal zero or false. in the example above, i check to see if htmlgoodies exist within . since the answer is true, then the code inside the if. then. statement will execute.inside the if. then. i use an appl

24、ication variable. an application variable is native to asp. application variables store information as long as a web application exist, a web application ceases to exist when say someone shuts off the web hosting server. the beauty of an application variable is that you can define it on one web page

25、 and use it in other web pages within your web application. the downfall is that the users computer must have cookies enabled.anyways, the code adds one to the application variable, every time a banner is clicked. after one is added, the code redirects to the banners web page. so if banner1 was clic

26、ked then you shall be redirected to .response.redirect strurlexample.aspthis is an example page that uses the banner ad system. when you refresh the page, you should most likely see a different banner. whenever you want to insert the banner ad on a page, you can use the ssi directive below.once you

27、include the file above, then you can call the sub-procedure inside the banner.asp file like so.call banner(_blank)notice that i supply one of the values for the targetframe as an argument. so if the banner is clicked, then the web page should open up in a separate browser window.clicks.aspthis is a

28、very simple page that displays the number of clicks per banner ad. to display the number of times a banner was clicked, you just print the contents of the application variables that were created inside redirect.asp. pretty nifty.asp橫幅廣告系統(tǒng)喬給讀者的話:這是一個(gè)由用戶提交上述筆者的教程。我已經(jīng)閱讀教程和設(shè)置格式,以適應(yīng)的html超值,但大部分都沒(méi)有改變的語(yǔ)言。我

29、選擇了這個(gè)教程,因?yàn)楹芏嘧x者已經(jīng)要求更多的asp教程。這是一個(gè)偉大的。對(duì)不起,我不能告訴你這里的事件。服務(wù)器的html超值不提供的asp。我會(huì)告訴你,不過(guò),如果你運(yùn)行的ie5.0或更高,打開(kāi)zip文件的內(nèi)容到一個(gè)目錄,它運(yùn)行得很好。如果你還沒(méi)有,你可能會(huì)想讀這之前我介紹的asp教程。如果沒(méi)有,那么享受??赡軙?huì)出現(xiàn)在你的網(wǎng)頁(yè)設(shè)計(jì)生涯中,在您的網(wǎng)站變成真正的流行點(diǎn)。這是當(dāng)企業(yè)成為您的網(wǎng)站上刊登廣告感興趣。可以建立一個(gè)橫幅廣告系統(tǒng),控制所有你所以愿意以優(yōu)惠的價(jià)格,以顯示這些廣告。active server pages的,使得它很容易地創(chuàng)建一個(gè)橫幅廣告系統(tǒng)。那么容易,微軟的asp開(kāi)發(fā)人員創(chuàng)建了一個(gè)組件

30、之際的“adrotator”。在你開(kāi)始閱讀本文之前,確保你下載下面的支撐材料。這些文件包括ad.txtbanner.asp3 banner imagesclicks.aspexample.aspredirect.aspad.txt為了adrotator組件來(lái)工作,你必須配置一個(gè)文本文件。這個(gè)文本文件包含了所有的橫幅廣告屬性。然而,文本文件必須遵循一定的格式。前四行如下.redirect redirect.aspwidth 400height 50*重定向當(dāng)點(diǎn)擊旗幟“的adrotator”組件去一個(gè)初步的頁(yè)面。此頁(yè)被稱為重定向頁(yè)面。重定向頁(yè)面處理指導(dǎo)用戶橫幅目的地之前,任何額外的編程事件。在這個(gè)

31、例子中的旗幟,我稱為“redirect.asp”初步文件。寬度此設(shè)置的橫幅廣告圖片的寬度。該值必須以像素為單位。高度這設(shè)置的橫幅廣告形象的高度。該值必須以像素為單位。*星號(hào)告訴的“adrotator”的組成部分,這是有關(guān)收購(gòu)橫幅廣告信息。星號(hào)是必需的。一旦你定義了星號(hào)以上的一般性質(zhì),然后是列表顯示的橫幅。在ad.txt文件,有星號(hào)下面定義了三個(gè)橫幅。banner1.jpghtmlg20banner2.jpgy30banner3.jpgd30每個(gè)旗幟需要四行屬性,按照下面的格式.圖像的文件名網(wǎng)址描述旗幟重量影像檔圖像的文件名可以是一個(gè)完全合格的網(wǎng)絡(luò)地址或相對(duì)指向圖像的名稱。如果圖像是在不同的文件

32、夾,那么你還包括文件夾的名稱。(網(wǎng)址網(wǎng)絡(luò)地址可以是您的網(wǎng)站或完全限定的網(wǎng)絡(luò)地址,導(dǎo)致另一個(gè)網(wǎng)站的頁(yè)面。描述說(shuō)明將顯示為工具提示。當(dāng)你休息的旗幟,你的鼠標(biāo),彈出的描述。旗幟重量多少顯示的一面旗幟,旗幟重量決定。“的adrotator”組件添加了所有的旗幟權(quán)和決定的可能性或正在顯示一個(gè)特定的橫幅的機(jī)會(huì)。具有較高的權(quán)重的旗幟,具有較好的一個(gè)更好的概率。注意:您可以禁用代以破折號(hào)1橫幅財(cái)產(chǎn)。banner3.jpg-d30上面的條目示例將創(chuàng)建一個(gè)橫幅廣告,沒(méi)有一個(gè)網(wǎng)址。banner.asp此文件使用“的adrotator”組件和分析的ad.txt文件內(nèi)容。下面是代碼。sub banner(strtarg

33、et)dim bannerad, htmlset bannerad = server.createobject(mswc.adrotator)bannerad.targetframe = strtargethtml = bannerad.getadvertisement(ad.txt)response.write htmlend sub首先要注意的是用vbscript編寫的asp。第二件事要注意的是,代碼內(nèi)編寫一個(gè)子過(guò)程稱為橫幅(strtarget)。對(duì)于那些你誰(shuí)也不知道,子過(guò)程允許你組合到一起一堆代碼可以一遍又一遍地重復(fù)使用。就像一個(gè)函數(shù),它需要一個(gè)參數(shù),如一個(gè)字或變量。在上述參數(shù)的代碼是s

34、trtarget。不像一個(gè)函數(shù),子過(guò)程不返回任何值,它只是按行內(nèi)執(zhí)行的代碼。內(nèi)子,我聲明兩個(gè)變量.dim bannerad, html接下來(lái),我將內(nèi)部的“bannerad”變量“adrotator的”組成部分。存儲(chǔ)組件內(nèi)部變量當(dāng)您使用設(shè)定的關(guān)鍵字。因?yàn)槲覀兪怯胊sp編程服務(wù)器端,我們使用server.createobject,召喚組件。的“mswc.adrotator”組件鍵或名稱值。set bannerad = server.createobject(mswc.adrotator)接下來(lái),我使用“的adrotator”稱為“targetframe”的屬性。此屬性相當(dāng)于.目標(biāo)的值可以是下列值之

35、一._blankopens the destination link in a new browser window._topopens the destination link on top of the web page._parentopens the destination link within a parent frame._newopens the destination link in a new browser window.接下來(lái),我使用“的adrotator”的方法或函數(shù)稱為“getadvertisement”,其結(jié)果存儲(chǔ)在變量的“html”。請(qǐng)注意,“getadvertisement”廣告橫幅文本文件作為一個(gè)參數(shù)的名稱。html = bannerad.getadvertisement(ad.txt)最后,我想打印的“html”變量的內(nèi)容。打印顯示的橫幅圖片的代碼?;貜?fù)于htmlredirect.asp這是被處理的文件之前,有人被重定向到的橫幅網(wǎng)頁(yè)地址。在這個(gè)文件中,我們可以抓住這樣一個(gè)特定的旗幟多少次被點(diǎn)擊等信息。要開(kāi)始做事了,我定義了一個(gè)名為“strurl的變量。dim str

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論