📄 addcontact.asp
字号:
<!--#include file="../function/connect.asp"-->
<!--#include file="../function/function.asp"-->
<%
ID=request("ID")
%>
<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.Contact_Name.value==""){
alert("姓名不能为空");
document.form1.Contact_Name.focus();
return false;
}
if(document.form1.Province_ID.value==""){
alert("省份不能为空");
document.form1.Province_ID.focus();
return false;
}
if(document.form1.City_ID.value==""){
alert("城市不能为空");
document.form1.City_ID.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.Province_ID.length = 0;
var i;
document.form1.Province_ID.options[0] = new Option('====选择====','');
for (i=0;i <subcat.length; i++)
{
document.form1.Province_ID.options[document.form1.Province_ID.length] = new Option(subcat[i][0], subcat[i][1]);
}
}
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.City_ID.length = 0;
var i;
document.form1.City_ID.options[0] = new Option('====选择====','');
for (i=0;i <subcat.length; i++)
{
document.form1.City_ID.options[document.form1.City_ID.length] = new Option(subcat[i][0], subcat[i][1]);
}
}
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">
<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
<form name="form1" method="post" action="../function/InsertToDB.asp?InsertTable=Contacts&RedirectUrl=../clients/editcontact.asp?ID=<%=ID%>" onsubmit="return check();">
<tr>
<td colspan="6" height="25" class="tablehead">
<div align="center">添加联系人信息</div>
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">姓名:</div>
</td>
<td colspan="3" height="22">
<input type="text" name="Contact_Name" size="8" maxlength="30" class="input">
称呼
<select name="Nickname">
<option value="先生">先生</option>
<option value="女士">女士</option>
<option value="小姐">小姐</option>
<option value="太太">太太</option>
</select>
<input type="checkbox" name="Primary" value="1">
主联系人</td>
<td width="16%" height="22" nowrap>
<div align="right">办公电话:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Phone1" size="20" maxlength="30" class="input">
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">客户:</div>
</td>
<td colspan="3" height="22">
<select name="client_ID" style="width:200">
<%
strsql="select client_name,client_id from clients where client_owner='" & session("loginuser") & "' or IsPublic=1"
Set objRs = Server.CreateObject("adodb.recordset")
objRs.Open strsql,objConn,1,1
if not objrs.eof then
do while not objrs.eof
if ID&"" = objrs.fields("client_id")&"" then
response.write "<option value=" & objrs.fields("client_id") & " selected>" & objrs.fields("client_name") & "</option>"
else
response.write "<option value=" & objrs.fields("client_id") & ">" & objrs.fields("client_name") & "</option>"
end if
objrs.movenext
loop
end if
%>
</select>
</td>
<td width="16%" height="22" nowrap>
<div align="right">移动电话:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Mobile_Phone" maxlength="30" size="20" class="input">
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">部门:</div>
</td>
<td width="12%" height="22">
<%getSelect "Department_ID","select * from Dict_Department ","Department","Department_ID"%>
</td>
<td width="8%" height="22" nowrap>
<div align="right">职务:</div>
</td>
<td width="18%" height="22">
<%getSelect "Title_ID","select * from Dict_Title ","Title","Title_ID"%>
</td>
<td width="16%" height="22" nowrap>
<div align="right">家庭电话:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Home_Phone" maxlength="30" size="20" class="input" >
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">国家/地区:</div>
</td>
<td width="12%" height="22">
<select name="Country_ID" style="width:100" onchange="getCountry(this);">
<%
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
%>
<option value="<%=objrs1.fields("Country_ID")%>"><%=objrs1.fields("Country")%></option>
<%
objrs1.movenext
loop
end if
set objRs1=nothing
%>
</select><input type=button value='...' class='button' onclick=Openwin("Country.asp");>
</td>
<td width="8%" height="22" nowrap>
<div align="right">国际区号:</div>
</td>
<td width="18%" height="22">
<input type="text" name="Country_Code" size="10" maxlength="8" class="input" readonly>
</td>
<td width="16%" height="22" nowrap>
<div align="right">传真:</div>
</td>
<td width="37%" height="22">
<input type="text" name="FAX1" maxlength="30" size="20" class="input" >
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">省份:</div>
</td>
<td width="12%" height="22">
<select name="Province_ID" onchange="fnDo1('Dict_Cities','Province_ID','City_ID',this.value,'City');fnDo2('Dict_Cities','Province_ID',this.value,'Area_Code','document.form1.Area_Code');" style="width:100">
<option value="">====选择====</option>
</select><input type=button value='...' class='button' onclick=Openwin("Province.asp");>
</td>
<td width="8%" height="22" nowrap>
<div align="right">区号:</div>
</td>
<td width="18%" height="22">
<input type="text" name="Area_Code" size="10" maxlength="8" class="input" readonly onKeyUp='this.value=this.value.replace(/\D/gi,"")'>
</td>
<td width="16%" height="22" nowrap>
<div align="right">电子邮箱:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Email1" maxlength="50" size="20" class="input">
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">城市:</div>
</td>
<td width="12%" height="22">
<select name="City_ID" style="width:100" onchange="fnDo2('Dict_Cities','Province_ID',this.value,'ZIP','document.form1.ZIP');">
<option value="">====选择====</option>
</select><input type=button value='...' class='button' onclick=Openwin("City.asp");>
</td>
<td width="8%" height="22" nowrap>
<div align="right">邮编:</div>
</td>
<td width="18%" height="22">
<input type="text" name="ZIP" size="10" maxlength="8" class="input" readonly>
</td>
<td width="16%" height="22" nowrap>
<div align="right">业余爱好:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Hobbies" maxlength="50" size="20" class="input" >
</td>
</tr>
<tr>
<td width="9%" height="22" nowrap>
<div align="right">详细地址:</div>
</td>
<td colspan="3" height="22">
<div align="left">
<input type="text" name="Address" size="37" maxlength="100" class="input">
</div>
</td>
<td width="16%" height="22" nowrap>
<div align="right">特别纪念日:</div>
</td>
<td width="37%" height="22">
<input type="text" name="Special_Day" maxlength="30" size="20" class="input" onKeyUp='this.value=this.value.replace(/\D/gi,"")'>
</td>
</tr>
<tr>
<td colspan="6" height="22">
<input type="checkbox" name="IsPublic" value="1" checked>公开此条纪录
</td>
</tr>
<tr>
<td colspan="6" height="22">
<div align="center"> <input type="hidden" name="contact_owner" value="<%=session("loginuser")%>">
<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");
}
if(document.form1.Country_ID.options[document.form1.Country_ID.selectedIndex].value!=""){
fnDo('Dict_Provinces','Country_ID','Province_ID',document.form1.Country_ID.options[document.form1.Country_ID.selectedIndex].value,'Province');
fnDo2('Dict_Countries','Country_ID',document.form1.Country_ID.options[document.form1.Country_ID.selectedIndex].value,'Country_Code','document.form1.Country_Code');
}
if(document.form1.Province_ID.options[document.form1.Province_ID.selectedIndex].value!=""){
fnDo1('Dict_Cities','Province_ID','City_ID',document.form1.Province_ID.options[document.form1.Province_ID.selectedIndex].value,'City');
fnDo2('Dict_Cities','Province_ID',document.form1.Province_ID.options[document.form1.Province_ID.selectedIndex].value,'Area_Code','document.form1.Area_Code');
}
function getCountry(obj)
{
fnDo('Dict_Provinces','Country_ID','Province_ID',obj.value,'Province');
fnDo2('Dict_Countries','Country_ID',obj.value,'Country_Code','document.form1.Country_Code');
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -