With the popularization of the network, online survey can often achieve better results. In their own personal site to put a fun problem investigation board, indeed for the site Tim a lot of, and through the results of the survey you can more accurately understand the views of users on their site. As a webmaster, if your site also needs to investigate a topic, and you hate to use someone else's free board (free often comes at a price, such as advertising!). , then I suggest you take more than 10 minutes to read this article about using ASP to make a survey board. All you have to do is copy the code from the text to your machine and make a little change, and you immediately have a personalized survey board that belongs to you. All right, get up and look down.
The survey board has three files: Displays survey questions (research.html), handles user selection (select.asp), and browses survey results (viewresult.asp). The design idea is: The ASP obtains by the form the information, and accordingly modifies the record investigation obtains the ticket number the database, then the ASP reads the database, obtains each survey question the number of votes, passes the number of votes to adjust the corresponding bar chart display the width to be intuitive proportional to give the survey result. At the key point of the program, I have given a more detailed comment, here is no longer the basic knowledge of ASP. Readers can go to the Tao Bar ASP column to check. Of course, I would like you to debug the program on your own server, there is no understanding of the place, or check the side of the ASP technology Manual, look at the object, method or function of the detailed syntax to try to modify, see how the results change-this is a good way to learn programming.
I. Display of survey questions (research.html)
Survey problem design to be based on the actual situation, or pay attention to practicality or interesting, the style displayed on the Web page or simple or lively, this example is the author on the home page on the "21st century the most important thing?" "Interesting survey, to illustrate the problem, the following code omitted the beautifully decorated code, you can use the design of the table and other techniques to beautify the display of investigation problems. In order to submit or browse the survey without affecting the current page, the program is given a popup new window scheme.
Researchindex.html:
HTML >
Title > Survey Board test,/title
Head >
!--start: Defining a newly opened window--
Script Language=javascript >
!--
var NewWindow = null
function Openwindow (Htmurl)
{
if (! NewWindow | | newwindow.closed)
{
NewWindow =
window.open (Htmurl, "Newwin", "Toolbar=no,resiza =no,scrollbars=no,width=400,height=280");
}else
{
Newwindow.focus ();
}
}
-->
/script >
!--End: Defining a newly opened window--
/head >
Body >
!--Start: Survey topics, Options--
p > What do you think is the most important thing in 21st century? /p >
"Form method=" POST "action=" vote/select.asp "Name=" "The" "JavaScript" language= "
Onsubmit= "Openwindow ()" target= "Newwin"
P align= "left"
BR >
Input type= "Radio" value= "1" name= "Options" "Knowledge (Knowledge is Power)" BR
"Input type=" Radio "value=" 2 "name=" Options "> > Education (Academic Education Society does not end)
"Input type=" Radio "value=" 3 "name=" Options "" Money (Economy is Foundation) "BR"
Input type= "Radio" value= "4" name= "Options" > Love (Love never Goes to the grave) BR
Input type= "Radio" value= "5" name= "Options" the ideal (God, what is the ideal)
Input type= "Radio" value= "6" name= "Options" "democratic consciousness (concern politics)" BR "
Input type= "Radio" value= "7" name= "options" > > Scientific thought (rejuvenating by science and education)
"Submit" value= "Submission" name= "voting" of "input type="
[Input type= "button" value= "View" name= "Viewing" onclick= "Openwindow (vote/viewresult.asp)" "
/form >
!--Start: Survey topics, Options--
/body >
/html >