📄 edit_client.asp
字号:
<!--#include file="../function/connect.asp"-->
<!--#include file="../function/function.asp"-->
<%
ID=session("client_ID")
if ID="" then
response.write "参数错误"
response.end
end if
strsql="select * from clients where client_id=" & ID
'response.write strsql
Set objRs = Server.CreateObject("adodb.recordset")
objRs.Open strsql,objConn,1,1
client_country=objrs.fields("client_country")
client_province=objrs.fields("client_province")
client_trade=objrs.fields("client_trade")
client_city=objrs.fields("client_city")
client_origin=objrs.fields("client_origin")
client_type=objrs.fields("client_type")
client_status=objrs.fields("client_status")
client_country_code=objrs.fields("client_country_code")
client_income=objrs.fields("client_income")
client_province_code=objrs.fields("client_province_code")
client_postcode=objrs.fields("client_postcode")
client_address=objrs.fields("client_address")
client_tel=objrs.fields("client_tel")
client_fax=objrs.fields("client_fax")
IsPublic=objrs.fields("IsPublic")
%>
<html>
<head>
<title>添加客户</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../cssD.css" rel=stylesheet>
<script>
function check()
{
if(document.form1.client_name.value==""){
alert("客户名称不能为空");
document.form1.client_name.focus();
return false;
}
if(document.form1.client_country.value==""){
alert("国家地区不能为空");
document.form1.client_country.focus();
return false;
}
if(document.form1.client_province.value==""){
alert("省份不能为空");
document.form1.client_province.focus();
return false;
}
if(document.form1.client_city.value==""){
alert("城市不能为空");
document.form1.client_city.focus();
return false;
}
}
</script>
<script language="javascript">
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
function fnDo(strTable,strFIdName,strIdName,strIDValue,strShowName)
{
var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
var strURL = "GetCity.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowName="+strShowName+"&strFIdName="+strFIdName;
//alert(strURL);
xmlhttp.Open("POST",strURL , true);
xmlhttp.onreadystatechange = fnRun;
xmlhttp.Send(xmlDom);
}
//--------------------------------------------------------
function fnRun()
{
var state = xmlhttp.readyState;
var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
if (state == 4)
{
xmlDom.loadXML(xmlhttp.responseXML.xml);
//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
var getInfo = xmlDom.documentElement.selectSingleNode("//objXML").text;
//document.write(getInfo);
subcat = new Array();
eval(getInfo);
changelocation(subcat)
}
}
function changelocation(subcat)
{
document.form1.client_province.length = 0;
var i;
document.form1.client_province.options[0] = new Option('==选择==','');
for (i=0;i <subcat.length; i++)
{
document.form1.client_province.options[document.form1.client_province.length] = new Option(subcat[i][0], subcat[i][1]);
//alert(subcat[i][1]=='<%=client_province%>');
if(subcat[i][1]=='<%=client_province%>')
{
document.form1.client_province.options[i+1].selected=true;
fnDo1('Dict_Cities','Province_ID','City_ID',document.form1.client_province.options[i+1].value,'City');
}
}
}
function fnDo1(strTable,strFIdName,strIdName,strIDValue,strShowName)
{
var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
var strURL = "GetCity.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowName="+strShowName+"&strFIdName="+strFIdName;
//alert(strURL);
xmlhttp.Open("POST",strURL , true);
xmlhttp.onreadystatechange = fnRun1;
xmlhttp.Send(xmlDom);
}
//--------------------------------------------------------
function fnRun1()
{
var state = xmlhttp.readyState;
var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
if (state == 4)
{
xmlDom.loadXML(xmlhttp.responseXML.xml);
//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
var getInfo = xmlDom.documentElement.selectSingleNode("//objXML").text;
//document.write(getInfo);
subcat = new Array();
eval(getInfo);
changelocation1(subcat)
}
}
function changelocation1(subcat)
{
document.form1.client_city.length = 0;
var i;
document.form1.client_city.options[0] = new Option('====选择====','');
for (i=0;i <subcat.length; i++)
{
document.form1.client_city.options[document.form1.client_city.length] = new Option(subcat[i][0], subcat[i][1]);
if(subcat[i][1]=='<%=client_city%>')
{
document.form1.client_city.options[i+1].selected=true;
}
}
}
xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
function fnDo2(strTable,strIdName,strIDValue,strShowValue,strField)
{
var xmlDom2 = new ActiveXObject("Msxml2.DOMDocument");
var strURL = "GetCode.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowValue="+strShowValue+"&strField="+strField;
//alert(strURL);
xmlhttp2.Open("POST",strURL , true);
xmlhttp2.onreadystatechange = fnRun2;
xmlhttp2.Send(xmlDom2);
}
//--------------------------------------------------------
function fnRun2()
{
var state = xmlhttp2.readyState;
var xmlDom22 = new ActiveXObject("Msxml2.DOMDocument");
if (state == 4)
{
xmlDom22.loadXML(xmlhttp2.responseXML.xml);
//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
var getInfo = xmlDom22.documentElement.selectSingleNode("//objXML").text;
//alert(getInfo);
eval(getInfo);
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100" border="1" cellspacing="0" cellpadding="1" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
<form name="form1" method="post" action="../function/UpdateToDB.asp?InsertTable=clients&CheckIt=client_name&ModifyID=<%=ID%>&ModifyIDName=client_id&RedirectUrl=../clients/edit_client.asp?IID=<%=ID%>" onsubmit="return check();">
<tr>
<td colspan="6" height="25" class="tablehead">
<div align="center">添加客户信息</div>
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">客户名称:</div>
</td>
<td colspan="3" height="22" nowrap>
<input type="text" name="client_name" size="37" maxlength="100" class="input" value="<%=objrs.fields("client_name")%>">
</td>
<td width="10%" height="22" nowrap>
<div align="right">电子邮件:</div>
</td>
<td width="32%" height="22" nowrap>
<input type="text" name="client_email" size="23" maxlength="100" class="input" value="<%=objrs.fields("client_email")%>">
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">客户编码:</div>
</td>
<td width="90" height="22" nowrap>
<input type="text" name="client_code" maxlength="20" size="13" class="input" value="<%=objrs.fields("client_code")%>">
</td>
<td width="70" height="22" nowrap>
<div align="right">员工人数:</div>
</td>
<td width="90" height="22">
<input type="text" name="client_employer_num" maxlength="6" size="10" class="input" value="<%=objrs.fields("client_employer_num")%>">
</td>
<td width="10%" height="22" nowrap>
<div align="right">主页:</div>
</td>
<td width="32%" height="22">
<input type="text" name="client_homepage" maxlength="100" size="23" class="input" value="<%=objrs.fields("client_homepage")%>">
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">国家/地区:</div>
</td>
<td width="90" height="22" nowrap>
<select name="client_country" style="width:70" onchange="fnDo('Dict_Provinces','Country_ID','Province_ID',this.value,'Province');fnDo2('Dict_Countries','Country_ID',this.value,'Country_Code','document.form1.client_country_code');">
<%
strsql="select * from Dict_Countries"
Set objRs1 = Server.CreateObject("adodb.recordset")
objRs1.Open strsql,objConn,1,1
if not objrs1.eof then
do while not objrs1.eof
if objrs1.fields("Country_ID") & "" = client_country & "" then
%>
<option value="<%=objrs1.fields("Country_ID")%>" selected><%=objrs1.fields("Country")%></option>
<%
else
%>
<option value="<%=objrs1.fields("Country_ID")%>"><%=objrs1.fields("Country")%></option>
<%
end if
objrs1.movenext
loop
end if
set objRs1=nothing
%>
</select><input type=button value='...' class='button' onclick=Openwin("Country.asp");>
</td>
<td width="70" height="22" nowrap>
<div align="right">国际区号:</div>
</td>
<td width="90" height="22" nowrap>
<input type="text" name="client_country_code" size="10" maxlength="8" class="input" value="<%=client_country_code%>" readonly>
</td>
<td width="10%" height="22" nowrap>
<div align="right">年收入:</div>
</td>
<td width="32%" height="22">
<input type="text" name="client_income" maxlength="4" size="10" class="input" onkeyup='this.value=this.value.replace(/\D/gi,"")' value="<%=client_income%>">
万元</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">省份:</div>
</td>
<td width="90" height="22">
<select name="client_province" onchange="fnDo1('Dict_Cities','Province_ID','City_ID',this.value,'City');fnDo2('Dict_Cities','Province_ID',this.value,'Area_Code','document.form1.client_province_code');" style="width:70">
<option value="">==选择==</option>
</select><input type=button value='...' class='button' onclick=Openwin("Province.asp");>
</td>
<td width="70" height="22" nowrap>
<div align="right">区号:</div>
</td>
<td width="90" height="22">
<input type="text" name="client_province_code" size="10" maxlength="8" class="input" readonly value="<%=client_province_code%>">
</td>
<td width="10%" height="22" nowrap>
<div align="right">行业:</div>
</td>
<td width="32%" height="22">
<%getSelected "client_trade","select * from Dict_Industry","Industry","Industry_ID",client_trade%>
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">城市:</div>
</td>
<td width="90" height="22">
<select name="client_city" style="width:70" onchange="fnDo2('Dict_Cities','Province_ID',this.value,'ZIP','document.form1.client_postcode');">
<option value="">==选择==</option>
</select><input type=button value='...' class='button' onclick=Openwin("City.asp");>
</td>
<td width="70" height="22" nowrap>
<div align="right">邮编:</div>
</td>
<td width="90" height="22">
<input type="text" name="client_postcode" size="10" maxlength="8" class="input" readonly value="<%=client_postcode%>">
</td>
<td width="10%" height="22" nowrap>
<div align="right">客户类型:</div>
</td>
<td width="32%" height="22">
<%getSelected "client_type","select * from Dict_ClientTypes","Client_Type","Client_Type_ID",client_type%>
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">详细地址:</div>
</td>
<td colspan="3" height="22">
<div align="left">
<input type="text" name="client_address" size="37" maxlength="100" class="input" value="<%=client_address%>">
</div>
</td>
<td width="10%" height="22" nowrap>
<div align="right">客户来源:</div>
</td>
<td width="32%" height="22">
<%getSelected "client_origin","select * from Dict_ClientSources","Client_Source","Client_Source_ID",client_origin%>
</td>
</tr>
<tr>
<td width="10%" height="22" nowrap>
<div align="right">客户电话:</div>
</td>
<td width="90" height="22">
<input type="text" name="client_tel" size="13" maxlength="30" class="input" value="<%=client_tel%>">
</td>
<td width="70" height="22" nowrap>
<div align="right">客户传真:</div>
</td>
<td width="90" height="22">
<input type="text" name="client_fax" size="10" maxlength="30" class="input" value="<%=client_fax%>">
</td>
<td width="10%" height="22" nowrap>
<div align="right">客户状态:</div>
</td>
<td width="32%" height="22">
<%getSelected "client_status","select * from Dict_ClientStatus","Client_Status","Client_Status_ID",client_status%>
</td>
</tr>
<tr>
<td colspan="6" height="22">
<input type="checkbox" name="IsPublic" value="1" <%if IsPublic & ""="1" then%>checked<%end if%>>公开此条纪录
</td>
</tr>
<tr>
<td colspan="6" height="22">
<div align="center">
<input type="submit" value=" 保 存 " class="button">
<input type="reset" value=" 重 设 " class="button">
</div>
</td>
</tr>
</form>
</table>
</body>
</html>
<script>
function Openwin(str)
{
window.open(str,"","left=100,top=100,Width=500,Height=400,scrolling=yes");
}
function init(){
if(document.form1.client_country.options[document.form1.client_country.selectedIndex].value!=""){
fnDo('Dict_Provinces','Country_ID','Province_ID',document.form1.client_country.options[document.form1.client_country.selectedIndex].value,'Province');
}
if(document.form1.client_city.options[document.form1.client_city.selectedIndex].value!=""){
fnDo1('Dict_Cities','Province_ID','City_ID',document.form1.client_city.options[document.form1.client_city.selectedIndex].value,'City');
}
//checkProvince(<%=client_province%>);
//checkCity(<%=client_city%>);
}
function checkProvince(strp)
{
for(i=0;i<document.form1.client_province.length;i++){
var va=document.form1.client_province.options[i].value ;
var b1= va == strp;
//alert(b1);
if(b1)
{
document.form1.client_province.options[i].selected=true;
}
}
}
function checkCity(strc)
{
for(i=0;i<document.form1.client_city.length;i++){
if(document.form1.client_city.options[i].value ==strc){
document.form1.client_city.options[i].selected=true;
}
}
}
init();
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -