当前位置: 首页 > 图文教程 > 网络编程 > ASP > sdcms添加在线提交功能

ASP
asp生成三维饼图的函数
ASP下的简洁的多重查询的方法与函数 真不错
发一个ASP的ADODB类代码
A利用ASP小偷和Google实现在线翻译功能的代码
ASP类型网站结合动网论坛会员的方法
Asp下实现多表单域无组件文件上传的实例
asp制作中常用到的函数库集合
易心asp分页类 v1.0
asp中xmlhttp组件发包
检测是否为数字类型的asp代码
可以获得文件的文件名的asp函数
用asp实现访问远程计算机上MDB access数据库文件的方法
用ASP实现写IIS日志的代码
asp在IE浏览器中下载服务端上的各类文件的实现方法
asp汉字中文图片验证码的实现代码
asp WAP获取手机终端信息的一段代码
asp取得数组中的最大值的方法
用asp实现的截取指定格式字符串的代码
asp jmail发邮件 详细解析
ASP编程中连接数据库和数据库操作的常用代码

ASP 中的 sdcms添加在线提交功能


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 180 ::
收藏到网摘: n/a

sdcms在线提交的程序

回复 http://bbs.sdcms.cn/dispbbs.asp?boardid=2&Id=1557 帖子。感谢大家的支持!

代码如下

<!--#include file="inc/conn.asp" -->

<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
body,td,th {
 font-size: 12px;
}
-->
</style>

<script language=javascript>  
  function   isfull()  
  {  
      var   title   =   document.myform.title.value;  
      var   content   =   document.myform.content.value;  
   var   classid   =   document.myform.classid.value;
   var   author   =   document.myform.author.value;
   var   code   =   document.myform.code.value;
      if(title   ==   "")  
      {  
          alert("标题呢?");  
          document.myform.title.focus();  
          return   false;  
      } 
  
         if(content   ==   "")  
      {  
          alert("多少写点内容吧");  
          document.myform.content.focus();  
          return   false;  
      }
  
         if(classid   ==   "")  
      {  
          alert("选分类哦...");  
          document.myform.classid.focus();  
    return   false;
      }
  
            if(author   ==   "")  
      {  
          alert("留下您的大名吧");  
          document.myform.author.focus();  
    return   false;
      }
  
               if(code   ==   "")  
      {  
          alert("唉,不要忘记带验证马来");  
          document.myform.code.focus();  
    return   false;
      }
  
  
      if(classid   ==   "")  
      {  
          alert("选分类哦...");  
          document.myform.classid.focus();  
      }  
      return   true;  
  }  
  </script>


<title>在线提交笑话</title>
</head>
<table width="777" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="567" valign="top">
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td><a href="http://joke.yingzi001.cn">回首页</a>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <form action="add.asp?action=add" method="post" name="myform" id="myform" onSubmit="return   isfull();">  
    <tr>
                  <td align="center">
      <%if request("action")=""then%>
                    <table width="100%" border="0" cellpadding="5" cellspacing="0">
                      <tr>
                        <td width="20%" align="right">标题</td>
                        <td width="80%">
                          <input name="title" type="text" id="wp" size="35">
                          * 30个字为宜^-^</td>
                      </tr>
                      <tr>
                        <td width="20%" align="right">内容 </td>
                        <td>
                        <textarea name="content" cols="60" rows="10" id="content"></textarea></td>
                      </tr>
       <tr>
                        <td width="20%" align="right">类别</td>
                        <td>
                          <input name="classid" type="text" id="classid" size="3" readonly="readonly"  >
                          <%
   set rs_s=server.createobject("adodb.recordset")
   rs_s.open "select * from sd_class order by id ",conn,1,1
   %>
                        <select name="select2" onChange="(document.myform.classid.value=this.options[this.selectedIndex].value)"><option selected>请选择类别
                <%
   while not rs_s.eof
   %>
                <option value="<%=rs_s("id")%>"><%=rs_s("title")%></option>
                <%
   rs_s.movenext
   wend
   rs_s.close
   set rs_s=nothing
   %>
              </select>
                        * 分类自动对应序号</td>
                      </tr>
                    </table>
                    <table width="100%" border="0" cellpadding="5" cellspacing="1">
                                                            <tr>
                        <td width="20%" align="right" bgcolor="#FFFFFF">作者</td>
                        <td width="80%" bgcolor="#FFFFFF"><input type="author" name="author"/>
                        - 您的笔名或者网址都可以</td>
                      </tr>
                                        <tr>
                        <td width="20%" align="right" bgcolor="#FFFFFF">验证码</td>
                        <td><input name='code' type='text' size='6' maxlength="4"> 
  <img src="getcode.asp" alt= "看不清?点击换一头" style="cursor:pointer;height:20px;" onclick="this.src='getcode.asp'"></td>
                      </tr>
                    <tr>
                        <td width="20%" bgcolor="#FFFFFF">&nbsp;</td>
                        <td width="80%" bgcolor="#FFFFFF"><input type="submit" name="Submit2" value="提交我的笑话" /></td>
                      </tr>
                    </table>
     <%end if%>
      </td>
                </tr>
    </form>
              </table>
          </td>
   
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>

<%
if request("action")="add" then
If IsEmpty(Session("GetCode")) Or Session("GetCode") <> UCase(Request.Form("code")) Then
    response.write "<script>window.alert('验证马呢?吃草去了?本站规定,没有马是不得提交滴...');</script>"
    response.write "<script>location.href='add.asp'</script>"
    Response.End
Else
dim title,content,author,classid
title=Trim(request.Form("title"))
content=Trim(request.Form("content"))
author=Trim(request.Form("author"))
classid=Trim(request.Form("classid"))
set rs=server.createobject("adodb.recordset")

sql="select * from sd_info"
rs.open sql,conn,1,3
  rs.addnew
  call SaveData_dlinfo()
  rs.update
  rs.close
  set rs=nothing

call CloseConn()
response.write"<script>alert('OK!感谢您的关注!审核后即可显示!')</script>"
response.Redirect "add.asp"

end if

sub savedata_dlinfo
rs("title")=title
rs("content")=content
rs("author")=author
rs("classid")=classid
rs("adddate")=now
end sub
end if
%>

 

相应的字段,大家自己修改就可以了。呵呵,很easy的