Use ASP to implement advertising agency

Source: Internet
Author: User
A website A wants to find another website as an agent and insert its own advertisement on the agency's page. It provides a registration page to the agent. After the agent registers, it will get an ID and the advertisement code marked with this ID.
All the agents need to do is insert this code into their own web pages. Once someone clicks this advertisement. Website A will pay the money to the agent.
How is this technology implemented? This is a question that someone else gave me. Although it is not difficult, I think it is very representative, so I may wish to write it out for your reference.
Related knowledge
1. document object in JavaScript. The most common method of document is write. Document. write (str) can write str to the browser. In fact, document. write () and respose. write () is very similar, the difference is only that response is an asp object, is written from the Server to the Client, while document is a browser object, is locally written by the Client. (Too far-_-|)
2. The <script> tag has a src attribute. You can use a url to call the script.
Once you know this, you can do it.
Agent.htm
This is the agent page. We need to give the agency a piece of code to let them insert (rpwt ......).
<Script language = "javascript" src = "http: // localhost/AgentGet/Show. asp? AgentID = 1000 "> </script>
Agents need to do so much, and then they are waiting to receive the money. (Why can't I find this good thing ......)
Show. asp
Since Show. asp appears in the code, it must be written. In practice, the show.aspjob outputs javascriptto the browser. When agent.htm is used to call the <script> src, criptcan be executed in agent.htm.
<%
Id = Request ("AgentID ")
Txt = "<a href = 'http: // localhost/AgentGet/GetID. asp? AgentID ="
Txt = txt & id & "'>"
Txt = txt & ""
Txt = txt & "</a>"
Js = "document. write (" "& txt &""");"
Response. write js
%>
This is all the content of Show. asp. Is it short? I like simple and practical things, such as VB and C ...... (Where did you go ...... 0_o)
People familiar with ASP can see it at a glance. After the request is sent to the id, use document. write () to output a piece of javascript. This section of javascript is actually a piece of html, that is, displaying an image with a hyperlink and using the id as a part of the link.
GetID. asp
The last thing is to get the ID.
<%
Id = Request ("AgentID ")
Response. Write "The Agent's ID is" & id
%>
After obtaining the Agent ID, you can update the database. Finally, Redirect to the ad page is done.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.