|
||
| Inside Technique : Popup Surveys In this article, we show you how to create a pop-up survey window like the one displayed when you entered this page. In this technique, we show you how to popup a survey window as the page is being downloaded. While the user is waiting for the page to download the survey popup enables web-designers to quickly ask simple questions. The survey window is also a way to interact with the user during the download period. We had the following goals when we created this survey:
To solve the first goal, we embed the survey script on the page before the document's contents are reached. In addition, the survey is completely self-contained in the script. This allows the survey to be displayed without requiring an additional round-trip. The second goal is a style decision. By generalizing the survey to a multiple choice question, we are able to write a generic routine for generating the survey. This also makes it possible to build surveys that randomly choose from multiple questions. Why we made this decision becomes more apparent when we walk you through the code. The last goals are also about user experience. Each survey question should only display once so the user is not asked the same question over and over again. Not only can this skew your survey, but it creates a poor user experience. To track if the user responded to the survey, a small cookie is stored on their machine. This cookie is tied to a specific question. This ensures any new surveys will be provided to the user. For example, if you answered the pop-up survey, try refreshing this page. The survey should not be displayed again. Next we take you through both the client-side script for generating the survey, and the server-side ASP script for processing the survey results. First we start with the client-side script. Page 1:Popup Surveys © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |