2005/11/03 | ASP三层架构中的事件处理/表单提交(1)
类别(Develop) | 评论(0) | 阅读(201) | 发表于 09:36
1.表单
/Admin/NewsForm.asp

<!--#include virtual="/Class/Package.asp"-->
<!--#include virtual="/Class/Bll/Admin.asp"-->
<!--#include virtual="/Class/Bll/News.asp"-->
<!--#include virtual="/Class/Bll/Class.asp"-->
<!-- #include file="FCKeditor/fckeditor.asp" -->
<%
Dim admin : Set admin = New BllAdmin
admin.CheckLogin()
Set admin = Nothing
Dim news : Set news = New BllNews
Dim action : action = "insert"
Dim id : id = Request.QueryString("NewsID")
If id <> "" Then
    action = "edit"
End If
If action = "edit" Then
    With news
        .NewsID = id
        .SelectOne()
        id = .NewsID
    End With
End If
%>
<HTML>
<title>后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/validator.js"></script>
<script type="text/javascript" src="js/cmd.js"></script>
<body>
<form id="news<%=action%>" method="post" action="/action/?actionID=<%=action%>" onSubmit="return Validator.Validate(this, 2)">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="title">
<tr>
<td width="40%">信息发布</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="add1">
<th> 标题:</th>
<td><input type="text" name="Title" class="input" dataType="Require" msg="必须填写标题" value="<%=news.Title%>"> </td>
</tr>
<tr class="add">
<th> 分类:</th>
<td>
            <select name="ClassID">
            <%
            Dim cls : Set cls = New BllClass
            If action = "edit" Then cls.ClassID = news.ClassID
            Response.Write cls.Tree
            Set cls = Nothing
            %>
        </select>
        </td>
</tr>
<tr class="add1">
<th colspan="2" align="center">
        <%
        Dim editor : Set editor = New FCKeditor
        editor.value = news.Content
        editor.Width = "98%"
        editor.Height = 300
        editor.Create "Content"
        %></th>
</tr>
<tr class="add">
<th>图片:</th>
<td><input name="Picture" type="text" id="Picture" value="<%=news.Picture%>"><input onclick="SelectImage('Picture')" type="button" value="选择图片"></td>
</tr>
<tr class="add1">
<th>附加:</th>
<td><label>推荐
<input name="IsCommend" type="checkbox" id="IsCommend" value="1"<%If news.IsCommend = True Then Response.Write " checked"%>>
初始点击数:
<input type="text" size="5" name="Hits" datatype="Number" msg="点击数只能为整数" value="<%=news.Hits%>">
</label></td>
</tr>

</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="page">
<tr>
<td width="40%">     <input type="hidden" value="<%=id%>" name="NewsID">
            <input type="image" name="ibModify" src="images/enter.gif">
<img src="images/reset.gif" width="46" height="20" style="CURSOR:hand" onClick="document.forms[0].reset()"></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</HTML>
<%
Set news = Nothing
%>

其中Package.asp代码为:

<!--#include virtual="/Class/validator.asp"-->
<!--#include virtual="/Class/Exception.asp"-->
<!--#include virtual="/Class/State/Cache.asp"-->
<!--#include virtual="/Class/State/Session.asp"-->
<!--#include virtual="/Class/State/Cookie.asp"-->
<!--#include virtual="/Class/Pager.asp"-->
<!--#include virtual="/Class/Text/Utility.asp"-->
<!--#include virtual="/Class/Oledb.asp"-->


(未完待续)
0

评论Comments

日志分类
首页[66]
Develop[14]
Plus[3]
Melody[7]
Essay[38]
Archive[4]