The basic routine for adding a new web tag category is:
first, select the "adding a new web tag category" command, a dialog
box then pops up to prompt you to enter the new name for the category, and
after clicking "OK," the new tag category will be added to the system
behind the scene and the page will be updated consequently.
In detail, adding a new web tag category is also divided
into two parts. First, the server-side page (AddSection.aspx) invokes the
stored procedure AddSection according to the passed argument (the tag category
name) to implement the adding tag category operation.
Next, the client side JavaScript code use ProtoType's "Ajax.Request"
object to send out a request to page AddSection.aspx; and if the request
succeeds, the new category list will be refreshed consequently. Listing 14 gives
the related script code.
Listing 14
function AddSection() {
var sectionName = window.prompt("Please enter a new tag category name");
if (sectionName) {
var paras = "name=" + escape(sectionName);
new Ajax.Request("AddSection.aspx", {
mothed: "GET",
parameters: paras,
onComplete: function(xmlhttp) {
new Ajax.Request("ListSection.aspx", {onComplete: InitSection});
});
}
}
The following figure illustrates one of the running-time
snapshots for adding a new tag category operation. When we first click the "Add
a new tag category" menu item, a related dialog box pops up that requires
you to enter the new name and when you press "OK," the
newly-populated tag category name will be added into the tag category list.
Figure 6
Next, let us continue to see how to delete a specified tag
category.