Design ultra-Simple message with Dreamweaver MX 2004 (ii)

Source: Internet
Author: User
Tags continue empty html tags first row dreamweaver
dreamweaver| Design

Related article: with Dreamweaver MX 2004 design Super Simple message book

Then last night's tutorial continue to explain to us, before the message can only display data, let us give it life, let this message board to interact with netizens, we can actively speak, talk about Kan mountain. First of all to do a write a message page, in order to simplify, we write a message to the Web page and submitted to save the message of the page divided into two, so easy to read, to facilitate the analysis of students.

We first write a message to the Web page, static or dynamic Web pages can be, do not need any ASP code, it is best to build a static file, so that browsing speed, do not increase the burden of the server, is not to say that all of the ASP Web page is good oh, if necessary when the shot on the : only to provide the interface to write a message for users to fill out, new write.asp, typesetting the following figure:

Note that each text field is named, preferably the same as each field in the datasheet, so that the assignment is easy to match, without error. Then select the red dotted form, in the property bar in the action Bar to fill in the save.asp, this is the future to receive the user's message and saved to the database, we will continue to do this page later. The following figure:

Write the form page of the message is very simple, so finished, we do not think there is much trouble ah:

Next we begin to produce the Web page that receives the Netizen to leave a message and processing, new save.asp webpage, the webpage that submits the last time to make the page name wants to be consistent ah, can't name casually. At the top of the page HTML tag, add the following Red Line box code, as shown in the following figure:

The above code is divided into several paragraphs, and explain the meaning of each piece of code, are common basic operation, relatively simple, if a bit difficult, first put a put, first learn the ASP basis to say oh. Note that we have added two functions to the red line.

One is the trim function, is used to help us remove unnecessary spaces, a lot of people are accustomed to playing a few more spaces out, we use this function to remove the space on the line.

There is also a replace function, we wrote a lot of words in the message content, it will automatically wrap on the side, or generate a paragraph to generate a carriage return, which is normal in the form text area before the submission, but the database does not recognize the two special symbols after submission, the message page will only generate a row, which is incredible ah, It's very uncomfortable to keep the form wide and wide. Instead, replace helps us solve this problem by finding all the line breaks and carriage returns in the text paragraph (vbCrLf is the code for the line-feed and carriage returns) and automatically converts to the <br> string so that the HTML can be interpreted correctly.

Submit Save the Message page is basically completed, in order to be more friendly, to express the success of the submission, we do a little more work, all for the convenience of netizens! We return to the Design view environment, insert a large table in the center, write "message success!" 2 seconds to automatically return home ", in the return of the home page to add links to index.asp Web pages." The following figure:

After the successful submission of 2 seconds after the automatic return home page, is not very difficult ah?? In fact, it is not difficult! With the Dreamweaver function to easily solve this problem, we operate the following figure:

A dialog box will pop up, as shown below:

Fill in the above content, OK, is not too easy, don't be too proud of Ah!

Our Post submission Message page is over, we are not very excited, you can leave a message, hurriedly pull people to try it, the fierce irrigation of their own addiction it: This is not good for us, we must bang finish other work, is the reply page and delete page, with more than the basis, it is more relaxed, believe me, is true!

Last made the message board has vitality, can be interactive to submit a message, but not so rampant, we have to do a delete page, delete useless garbage, online also need environmental protection Oh.

Cut the crap, let's start by building the delete page, named Del.asp. Switch to Code view, delete all the HTML tags, add the following code, see the following figure:

When you finish writing the code, you finish making the deletion page. Let's analyze the meaning of the above code block:

  The third line of code: is the deletion of statements, where followed by the conditional statement, only to delete the data passed over the ID value, this is key, must be set up, otherwise the data table will be all the fields empty, which is too scary.

Code line FOURTH: The Conn object executes the DELESQL DELETE statement result.

Lines Fifth and sixth: close the Conn object and set it to empty to release the resource.

Code line seventh: Response.Redirect is the output to the object, indicating that after the deletion automatically turned to the home page.

Then we have to do a reply page, must have come back, or else the enthusiasm of others you do not reply, will also cool down. So it is necessary oh: To create a new reply.asp page, in the Design view of the first row, the following figure:

Note the red line where you want to add hidden fields, so that the purpose is to prevent the form from being submitted but the page refresh is executing code error, set as above.
  
When you are ready to switch to Code view, navigate to the top of the HTML tag, add the following Red Line box code, see the following figure:

Above the meaning of the code block I have been repeated on the above, not repeated, if you do not understand, please put forward in the talk, I will add. Here I will explain the reply module code:

Code line Fourth: Locate the response location, where followed by the response condition, only accept the message ID value we passed over, and assigned to the current ID variable, so we will only reply to the current Message page to reply, this is the key, otherwise all messed up.

Code line sixth: To determine whether the form is submitted or refreshed, if the form is submitted, the value of the hidden field is definitely committed, so that Request.Form ("active") is not empty, the following reply statement is executed. If the form is not submitted, but the page is refreshed, then the value of the hidden field is not committed, and Request.Form ("active") is definitely empty, skipping execution.

Code line Eighth: Note that this code is not rsedit.addnew before, because this is the update of the original record, in the original message in the Append reply content, rather than add a new record.

Reply code set up, we go back to the Design view environment, first positioned to reply to the message next to the cell, click on the property bar after clicking the Edit button, pop-up edit box after the code "Rsedit (" content ")" OK. The following figure:

Select the red dotted form and fill in the Action bar as follows: "Reply.asp?id=<%=request (" id ")%>", as shown in the following figure:

Reply page We are done, is it done? Don't get excited, there is another thing, forget to the home page index.asp Delete and reply to publish a new theme these three add link, that is not empty talk, hurriedly fill up! Link settings See the following figure:

This is the end of the tutorial on Jane, is it very simple? I do not know how the harvest? Hope to be able to feedback to me oh. Here I will provide the source code for this tutorial, give everyone a convenient, you can directly control, I wish you success!

This message can also be more humane a point! For example, if the user does not fill in the OICQ or email address will not show up! Of course, the reply and delete is to be authenticated by login! These things I believe is the author to stay to let friends do their own! Encourage this good tutorial!

  Click here to download the message source program



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.