⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 product_edit.asp

📁 这是一个物流网站的源代码
💻 ASP
字号:
<!--#include file="../inc/CheckAdmin.asp"-->
<!--#include file="../inc/Config.asp"-->
<!--#include file="../inc/Conn.asp"-->
<% 
Dim Language,table,Sortid
Language=formatStr(Request("Language"))
if Language="" then Language="C"
  
Sortid=formatStr(request("Sortid"))
Sortid2=formatStr(request("Sortid2"))
Sortid3=formatStr(request("Sortid3"))

if Sortid="" or not isnumeric(Sortid) then Check_Alert "非法操作","Product_admin.asp"
if Sortid3="" or not isnumeric(Sortid3) then Check_Alert "非法操作","Product_admin.asp"
 
id=request("id") 
If id="" or not isnumeric(id) then Check_Alert "非法操作","Product_admin.asp"  

if request.form("add")=1 then
	rs.open"select * from houyun where h_id="&request("id"),conn,1,3
	'sql="Update houyun set h_from="&request.Form("Sortid")&",h_to="&request.Form("Sortid3")&",h_area="&request.Form("Sortid2")&" where h_id="&id
	'response.Write(sql)
	'response.End()
	if rs.eof then
		rs.addnew
	end if
        rs("h_from")=request.Form("Sortid")
		rs("h_to")=request.Form("Sortid3")
        rs("h_area")=request.Form("Sortid2")
		rs("h_lifang")=request("qh")
        rs("h_price")=request("zh")
        rs("h_time")=request("sx")
        rs("h_fangshi")=request("fs")
        rs("h_licheng")=request("lc")
        rs("h_content")=request("sm")
    rs.update
	rs.close
	set rs=nothing
	check_alert "修改成功!","Product_Admin.asp"
	closeconn
	response.redirect("Product_Admin.asp")
	response.end
end if
   rs.open"select * from houyun where h_Id="&request("id"),conn,1,1
   if not rs.eof then
      	id=rs("h_id")
		Sortid=rs("h_from")
		Sortid3=rs("h_to")
       	Sortid2=rs("h_area")
		qh=rs("h_lifang")
       	zh=rs("h_price")
       	sx=rs("h_time")
       	fs=rs("h_fangshi")
       	lc=rs("h_licheng")
       	sm=rs("h_content")
   end if
   rs.close  
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站管理系统</title>
<link href="../Css_Main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #FF0000}
.style1 {color: #CCCCCC}
.Maxl {height: auto;
	width: 100px;
}
-->
</style>
</head>

<script language="JavaScript">
function GetResult(str,classid)
{
/*
*--------------- GetResult(str,classid) -----------------
* GetResult(str) 
* 功能:通过XMLHTTP发送请求,返回结果.
* 参数:str,字符串,发送条件;classid,数字,菜单级别
* 实例:GetResult(document.all.userid.value,1);
*--------------- GetResult(str,classid) -----------------
*/
//定义菜单级数,菜单ID数组,菜单对应字段数组
var MenuIdArr,MenuFieldArr,MenuClass
MenuIdArr= new Array()
MenuFieldArr=new Array()
MenuClass=2

MenuIdArr[1]="Sortid2"
MenuIdArr[2]="Sortid3"
//MenuIdArr[3]="sel3"
//MenuIdArr[4]="sel4"

MenuFieldArr[1]="ht_name"
MenuFieldArr[2]="ht_name"
//MenuFieldArr[3]="ps_name"
//MenuFieldArr[4]="ps_name"


if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
}


var linkurl="../../inc/ajax_server.asp?classid="+classid+"&sel="+str+"&fieldname="+MenuFieldArr[classid+1]
http_request.open("GET",linkurl,false);
http_request.send(null);

//服务器端处理返回的是经过escape编码的字符串.
//在页面显示服务器查询结果

var returntxt=unescape(http_request.responseText)
if(returntxt.length>0)
{document.all,ajax.innerHTML="返回结果:<font color='red'>"+returntxt+"</font>"}
else
{document.all,ajax.innerHTML=""}

//通过XMLHTTP返回数据,开始构建Select.
//BuildSel(returntxt,eval("document.all."+MenuIdArr[classid+1]))
BuildSel(returntxt,document.getElementById(MenuIdArr[classid+1]))

//============更改下下级以下菜单为空==============
var kkk
for(kkk=classid+2;kkk<=MenuClass;kkk++)
	{		
	submenu=document.getElementById(MenuIdArr[kkk])	
	submenu.length=1
	submenu.options[0].selected=true
	}
}

function BuildSel(str,sel)
{
/*
*--------------- BuildSel(str,sel) -----------------
* BuildSel(str,sel) 
* 功能:通过str构建Select.
* 参数:str,字符串,由服务端返回的.有特定结构"字符串1|,字符串2,字符串3"
*          也可为"字符串1序号|字符串1文本,字符串2序号|字符串2文本,字符串3序号|字符串3文本",如本例
* 参数:sel,要构建的Select
* 实例:BuildSel(unescape(oBao.responseText),document.all.sel2)
*--------------- BuildSel(str,sel) -----------------
*/
//先清空原来的数据.
sel.options.length=0;
var arrstr = new Array();
arrstr = str.split(",");
//开始构建新的Select.
sel.options.add(new Option( "---请选择---",""));  
if(str.length>0)   
{
for(var i=0;i<arrstr.length;i++)
{
//分割字符串
var subarrstr=new Array
subarrstr=arrstr[i].split("|")
//生成下级菜单
sel.options.add(new Option(subarrstr[1],subarrstr[0])); 
}
sel.options[0].selected=true
}

}
</script>

<script language="JavaScript">
function  Check()
{
	 if (form.Sortid.value == "") 
	 {alert(" 请选择起运站。");
	     form.Sortid.focus();
		return false;
		}
		
	if (form.Sortid3.value == "") 
	 {alert(" 请选择目的站。");
	     form.Sortid3.focus();
		return false;
		}
		
	if (form.qh.value == "") 
	 {alert(" 轻货不能为空。");
	     form.qh.focus();
		return false;
		}
		
	 if (form.zh.value == "") 
	 {alert(" 重货不能为空。");
	     form.zh.focus();
		return false;
		}
		
	if (form.sx.value == "") 
	 {alert(" 到达时限不能为空。");
	     form.sx.focus();
		return false;
		}
		
		
	document.form.submit();
		}
</script>
<body>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr>
    <td class="title_dh"><div align="center">路线管理——修改路线</div></td>
  </tr>
</table>
<form name="form" action="" method="post">
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr class="title_top">
    <td colspan="3"><div align="center">修改路线</div></td>
  </tr>
  <tr class="tdbg">
    <td width="20%"><div align="right"><strong>发货城市:</strong></div></td>
    <td colspan="2"><select name="Sortid" class="Maxl">
      <option value="">---请选择---</option>
      <%sql="select * from hfrom order by hf_id"
									set rs=conn.execute(sql)
									do while not rs.eof%>
      <option value="<%= rs("hf_id") %>"<% If rs("hf_id")=Sortid Then response.Write(" selected")%>><%= rs("hf_name") %></option>
      <%rs.movenext
									  loop
									  rs.close
									  set rs=nothing%>
    </select>
      <span class="style2">*</span>
      <input type="hidden" name="add" value=1 id="add"></td>
  </tr>
  <tr class="tdbg">
    <td><div align="right"><strong>区域:</strong></div></td>
    <td colspan="2"><select name="Sortid2" class="Maxl" onChange="GetResult(this.value,1)">
      <option value="">---请选择---</option>
      <%sql="select * from harea order by ha_id"
									set rs=conn.execute(sql)
									do while not rs.eof%>
      <option value="<%= rs("ha_id") %>"<% If rs("ha_id")=Sortid2 Then response.Write(" selected")%>><%= rs("ha_name") %></option>
      <%rs.movenext
									  loop
									  rs.close
									  set rs=nothing%>
    </select>
(选择区域可快速找到到货城市。)</td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>收货城市:</strong></div></td>
    <td colspan="2"><select name="Sortid3" class="Maxl">
  <option value="">---请选择---</option>
  <%sql="select * from hto order by ht_id"
									set rs=conn.execute(sql)
									do while not rs.eof%>
  <option value="<%= rs("ht_id") %>"<% If rs("ht_id")=Sortid3 Then response.Write(" selected")%>><%= rs("ht_name") %></option>
  <%rs.movenext
									  loop
									  rs.close
									  set rs=nothing%>
</select>
<span class="style2">*</span></td>
  </tr>
  <tr class="tdbg" style="display:none">
    <td>&nbsp;</td>
    <td colspan="2"id=ajax>&nbsp;</td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>运货方式:</strong></div></td>
    <td colspan="2"><select name="fs" class="Maxlenght" id="fs">
      <option value="公路"<% If fs="公路" Then response.Write(" selected")%>>公路</option>
      <option value="铁路"<% If fs="铁路" Then response.Write(" selected")%>>铁路</option>
      <option value="航空"<% If fs="航空" Then response.Write(" selected")%>>航空</option>
    </select></td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>轻货:</strong></div></td>
    <td colspan="2"><input name="qh" type="text" id="qh" value="<%= qh %>" size="40">
元/立方米 <span class="style2">*</span></td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>重货:</strong></div></td>
    <td colspan="2"><input name="zh" type="text" id="zh" value="<%= zh %>" size="40">
元/ 公斤 <span class="style2">*</span></td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>到达时限:</strong></div></td>
    <td colspan="2"><input name="sx" type="text" id="sx" value="<%= sx %>" size="40">
      <span class="style2">*</span></td>
  </tr>
  <tr class="tdbg" style="display:>">
    <td><div align="right"><strong>里程:</strong></div></td>
    <td colspan="2"><input name="lc" type="text" id="lc" value="<%= lc %>" size="40"></td>
  </tr>
  <tr class="tdbg" style="display:">
    <td><div align="right"><strong>说明:</strong></div></td>
    <td colspan="2"><textarea name="sm" cols="33" rows="5" id="sm"><%= sm %></textarea></td>
  </tr>
</table>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="40">
      <div align="center"><span class="style1">
        <input type="hidden" name="id" value="<%= id %>">
        <input name="Submit" type="button" id="Submit" value="修改" onClick="Check()">
&nbsp;
        <input name="reset" type="reset" id="reset" value="取消">
    </span> </div></td>
  </tr>
</table></form>
</body>
</html>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -