类别添加
名称:
 
正在发送数据请求…
<% dim strValue blnLogin = false; strValue = request.Form("txtName") Call DBConnBegin() sql="select * from about" oRs.open sql,oConn,1,3 if strValue="" then response.Write("类别不能为空") end if oRs.addnew oRs("about_title")=strValue oRs("about_senddate")=now() oRs.update blnLogin = true oRs.Close response.Redirect("DropdownEdit.asp") Call DBConnEnd() ‘sub addComments(id) ‘Call DBConnBegin() ‘strValue = request.Form("txtName") ‘sqlstr="insert into [comments](comm_user,comm_content,comm_pid) values(‘" &_unescape(trim(Request.Form("comm_user"))) & "‘,‘" & unescape(trim(Request.Form("comm_content"))) & "‘," & id & ")" ‘conn.execute(sqlstr) ‘response.Redirect("DropdownEdit.asp") ‘closeConn() ‘end sub %>
<script language="javascript" src="../../js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="../../js/jquery-1.4.2-vsdoc.js"></script> <script type="text/javascript" src="../../js/jquery-1.4.2.js"></script> <style type="text/css"> body{font-size:13px} .divFrame{width:225px;border:solid 1px #666} .divFrame .divTitle{padding:5px;background-color:#eee;height:23px} .divFrame .divTitle span{float:left;padding:2px;padding-top:5px;} .divFrame .divContent{padding:8px;text-align:center} .divFrame .divContent .clsShow{font-size:14px;line-height:2.0em} .divFrame .divContent .clsShow .clsError{font-size:13px;border:solid 1px #cc3300;padding:2px;display:none;margin-bottom:5px;background-color:#ffe0a3} .txt{border:#666 1px solid;padding:2px;width:150px;margin-right:3px} .btn {border:#666 1px solid;padding:2px;width:50px; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff, EndColorStr=#ECE9D8);} .SubTitle { padding-bottom:10px; font-weight:bold; display:none } </style> <script language="javascript"> function test() { if(AddPro.Kind_type.value=="请选择") { alert("请选择分类"); document.AddPro.Kind_type.focus(); return false; } } /* ***********下拉框选中****************/ function changeSelect( ) { var txtname=document.getElementById("txt_name"); var selects = document.getElementById("selects"); var textobj=document.getElementById(‘ta_info‘); var pid = document.getElementById(‘pid‘) var vA = selects.options[selects.selectedIndex].value; var vB = selects.options[selects.selectedIndex].text; textobj.innerHTML=textobj.name; document.location.href=vA; //重订向刷新 } $(function() { var speed = 1000; $("#button").click(function() { //$(".divFrame").show(speed); $.ajax({ //请求类别提交页 url:"addclass.html", //登录静态页 dataType: "html", success: function(HTML) { //返回页面内容 $("#form1").html(HTML); //将页面内容置入表单 $("#btnLogin").click(function() { //“添加”按钮单击事件 $(".SubTitle").show(speed); var strTxtName = encodeURI($("#txtName").val()); if (strTxtName=="") { $("#divError").show().html("类别不能为空!"); } else { //开始发送数据 $.ajax( { type: "post", //请求登录处理页 url: "addclass.asp", //提交处理处理页 //document.form1.action="FlotionEdit.asp?id="+ID; //document.form1.submit(); dataType:"html", //传送请求数据 data:{ txtName:strTxtName}, success: function(strValue) { //提交成功后返回的数据 //根据返回值进行状态显示 if (strValue == "True") { $(".SubTitle").hide(speed); $(".clsShow").html("操作提示,数据提交成功!"); } else { $("#divError").show().html("类别错误!"); } } }) }) } } }) }) }); </script> <div class="divFrame"> <div class="divTitle"> <span>类别添加</span> </div> <div class="divContent"> <div class="clsShow"> <div id="divError" class="clsError"></div> <div>名称: <input id="txtName" type="text" class="txt" /> </div> <div> <input id="btnLogin" type="button" value="提交" class="btn" />   <input id="btnReset" type="reset" value="取消" class="btn" /> </div> <div class="SubTitle">正在发送数据请求…</div> </div> </div> </div> <form name="form1" id="form1"> <input type="button" name="button" value="添 加" class=buttonCH id="button"/> <% dim strValue blnLogin = false; strValue = request.Form("txtName") Call DBConnBegin() sql="select * from about" oRs.open sql,oConn,1,3 if strValue="" then response.Write("类别不能为空") end if oRs.addnew oRs("about_title")=strValue oRs("about_senddate")=now() oRs.update blnLogin = true oRs.Close response.Redirect("DropdownEdit.asp") Call DBConnEnd() ‘sub addComments(id) ‘Call DBConnBegin() ‘strValue = request.Form("txtName") ‘sqlstr="insert into [comments](comm_user,comm_content,comm_pid) values(‘" &_unescape(trim(Request.Form("comm_user"))) & "‘,‘" & unescape(trim(Request.Form("comm_content"))) & "‘," & id & ")" ‘conn.execute(sqlstr) ‘response.Redirect("DropdownEdit.asp") ‘closeConn() ‘end sub %>
原文地址:https://www.cnblogs.com/dqh123/p/9470063.html