Dreamweaver MX Form Application Tips

Source: Internet
Author: User
Tags dreamweaver

In fact, the most basic network background is to crawl the database, only master this aspect of things you can more in-depth study. Of course, we only learn a little bit of dwmx, there are a lot of behavior (Server behaviors) will you go slowly groping, we can do is to take you into the MX world, to master the deeper things, it depends on your patience and will. Learning is happy, but also painful, especially when you encounter problems can not solve the time.

Starting today, we're going to explore some of the technical aspects, our skills are not operational, but in the background application, that is, ASP's skills. MX is able to generate code automatically, I believe that we have been a big leap, especially for those who design staff is no longer unreachable things. But everything has his negativity, and DWMX is no exception.

First of all: he generated too much code, not so easy for beginners to understand. Many times we can use less code instead of the code he generates automatically. Second: He needs to manage too much of the page, that is, to the Web maintenance personnel brought more trouble, we can often see in the Behavior dialog box has a after * * * *, is the hand when we complete this operation after the jump (tips: Jump can also be said to be directed, The ASP code is: Response.redircet "newpage.asp") to a new page. In fact, he can do a page, the advantage is that we have to maintain the page is less, you do not underestimate him, if you can master this skill, then you will be able to build less than 30% of the page, it is true, you do not be surprised.

Today we say this skill: here we mainly use a IF...ENDIF statement, which I think we all understand, how to achieve the specific?

For example: We want to build a login system, with the traditional dwmx do we want two pages, this is a very simple thing, just a few lines of code? So I decided to put him in a page.

Programming Idea: We want to establish the login system, must use the form, when the form submits we use Request.Form ("name") to obtain the value in the form, There is also a message between the client and the server way is request.querystring, he is passed along with the URL, is what we often see, http://www.cfsky.com/forum.asp?id=1. Id=1 is querystring, we can use Request.QueryString ("id") to get his value.

We want to achieve is to use if statements to check if there is no querystring, if not on the page generated form, if there is on the page output "welcome, Urban Ruthless people" (small tip: With Response.Write "You want to output the text" can output, you can use)

Create a basic form on the page, name Login.asp, everyone note: we

The action attribute is filled with the file itself, followed by a URL parameter, which is used to control the implementation of the ASP code in the page. The code is as follows:

< HTML >

< head >

< title >untitled document</title >

< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">

< BODY >

< form Name= "Form1" method= "Post" action= "Login.asp?action=yes" >

< p >

< input type= "text" name= "Textfield2" >

</p >

< p >

< input type= "text" name= "TextField" >

</p >

< p >

< input type= "submit" name= "send" value= "submit" >

</p >

</form >

</body >

Here we add the IF control statement:

< HTML >

< head >

< title >untitled document</title >

< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">

< BODY >

<% if Request.QueryString ("action") = "" Then% >

< form Name= "Form1" method= "Post" action= "Login.asp?action=yes" >

< p >

< input type= "text" name= "Textfield2" >

</p >

< p >

< input type= "text" name= "TextField" >

</p >

< p >

< input type= "submit" name= "send" value= "submit" >

</p >

</form >

<%

Else

Response.Write "Welcome you, City heartless man"

End If

% >

</body >

When the initial execution of the login.asp, because there is no URL parameter, so request.querystring ("action") = "" Is null, generate the form on the page, when we fill out the user name and password on the page, submit the form,< form name = "Form1" method= "Post" action= "Login.asp?action=yes" > This time, Request.QueryString ("action") = "yes", not empty, So execute Response.Write on the page "welcome you, City heartless man"

See, we added a few lines of ASP code to the two pages and come together, simple. Of course, this is a login system, also verify that the user entered the password is correct, here is not elaborated, because with DWMX is very easy to do, we only discuss the skills, if you want to do a login system, first spend two minutes with MX, and then insert the above if statement can be. Ha ha...

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.