Since the project requires a questionnaire, but the client requires that the title of the questionnaire must be pure HTML tags, so we are faced with a series of problems 1. How to submit the page <br />After the user completes the questionnaire, how to submit the survey results? 2 How to pass parameters to the page <br />After multiple people submit the same questionnaire, when the administrator views the questionnaire, how to pass parameters to ensure that the data seen is the questionnaire of a specified person. In fact, this problem can be solved by using the simplest query string in ASP.NET, but how to pass parameters in pure HTML? 3How to verify user identity <br />Users can answer the questions only after logging in. How to verify whether the user is logged in? The entire system is implemented using HTML? Can it be done? It doesn't seem possible. After all, the submitted data needs to be saved in the database, which I'm afraid cannot be done with pure HTML. So the basic idea is to use HTML static web pages for the front end, but csharp code must be used in the back end. 1How to submit a page <br />In fact, pure HTML can be submitted, mainly through the tag form. For example, the following code, after being submitted to savedata.aspx, can obtain all the data entered by the user, save it to the database after processing, and can be submitted through ajax or through the input type submit tag. Copy code The code is as follows:<input type="submit" value="Submit" /> Copy code The code is as follows:<form action="savedata.aspx" method="post"> <p>First name: <input type="text" name="fname" /></p> <p>Last name: <input type="text" name="lname" /></p> <input type="submit" value="Submit" /> </form> 2 How to pass parameters to the page <br />In ASP.NET, the easiest way to pass parameters to a page is through a query string. However, a pure HTML web page is a static web page without a corresponding background. How to pass parameters? For example, for the same set of questionnaires, Zhang San and Li Si both answered the questionnaires. The administrator wants to view Zhang San's questionnaire. How to reassign Zhang San's answers to the questions in the questionnaire? Since HTML is a static page, if you want to read data, you must dynamically read the answer through Ajax and then modify the static page. But how do you pass a parameter that represents a person? In fact, it is still through the query string, but the method of analyzing the query string has changed from the background to the front end, and it becomes to analyze the query string through js, and then read the data through ajax. Copy code The code is as follows:function QueryString(name ) { var sURL = window.location.search var re = new RegExp("" +name+ "=([^&?]+)", "ig"); var result = re.exec(sURL); if(result) { var temp = result[0].split('='); return temp[1] ; } else { return ""; } } Of course, there is another way. Since data is read through the background, the parameters can be obtained according to the information in the Session. However, if there is no relevant information in the Session, it can only be obtained through the query string. For example, in the example here, the only way is to use the query string. 3 How to verify user identity <br />Since the entire system cannot be completed using only HTML, the front-end display is pure HTML, and the back-end is csharp code, there is naturally a Session, and of course the user identity can be verified. If you need to determine whether a static HTML page is expired, you can call the background method through ajax to determine whether the user is logged in and whether it is expired based on whether the Session exists. |
<<: Tips for creating two-dimensional arrays in JavaScript
>>: How to mark the source and origin of CSS3 citations
Docker Features 1) Quick to get started It only t...
Three ways to use CSS in HTML: 1. Inline style: s...
Install GeoIP on Linux yum install nginx-module-g...
Table of contents Preface Promise chaining MDN Er...
HTML code: <a onclick="goMessage();"...
Abstract: MySQL provides a variety of storage eng...
When you browse many websites, you will find that ...
This article collects the fonts used in the logos...
This article shares the specific code of JavaScri...
1. Filter Example: <!DOCTYPE html> <html...
This article provides some commonly used rewrite ...
This article shares the specific code of JavaScri...
Preface When testing, in order to test the projec...
Method 1: Download Pycharm and install Download a...
This article mainly summarizes various problems o...