Advertising | Advertising has a website a want to find another site as an agent, on the agent's page to insert their own ads. It provides a registration page to the agent, the agent registered, will get an ID, and get the ID as the tag of the advertising code.
All the agents need to do is just insert the code into their own web page. Once someone clicks on the ad. Website A will pay the agent money.
So, how is this technology implemented? This is someone else to give me a topic, although not difficult, but I feel very representative, so may wish to write out for everyone to make a reference.
Related knowledge
1. The 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 () are very similar, the difference is that response is an ASP object, is written from server to client, and document is a browser object, is client-local write. (Pulled away-_-| | )
2. The <script> tag has a src attribute that can be invoked via a URL.
Knowing this, you can do it.
Agent.htm
This is the agent's page. We need to give the agent a piece of code, let them insert can be (RPWT ...) )。
<script language= "javascript" src= "http://localhost/AgentGet/Show.asp?AgentID=1000" ></script>
That's all the agency needs to do, and then just wait for the money. I can't find this good thing ... )
Show.asp
Now that there is a show.asp in the code, it must be written. In fact, the task of show.asp is to output a section of JavaScript to the browser, when agent.htm with the <script> src attribute calls, this JavaScript can be executed in the 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
%>
That's the whole story of Show.asp, is it short? I like the simple and practical dongdong, such as VB, C # ... (Where did he go?) 0_o)
The person who is familiar with ASP can see it at a glance. This thing is after the request to ID, with document.write () to output a piece of JavaScript, this javascript is actually a section of HTML, is to display a hyperlink picture, and the ID as 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 you get the ID of the agent, you can update the database. Finally, redirect to the advertising page, it is done.