<% Option Explicit '*********************************************** ' 說明:37080308通訊錄 ' 作者:gwd 2002-11-05 '*********************************************** %> <!--#include file="pub/funcxml.asp"--> <!--#include file="pub/constpub.asp"--> <!--#include file="pub/funcpub.asp"--> <!--#include file="pub/class/clsPerson.asp"--> <% Dim objXml, objPerson Dim strErr Set objXml = Server.CreateObject("MSXML2.DOMDocument") Set objPerson = New Cls_Person ' 產生Cls_Person物件If Request.Form("btnOk") <> "" Then If LoadXmlDoc(objXml, C_XMLFILE, False, strErr) Then ' 裝載XML檔案' 給對應的屬性賦值objPerson.Name = CheckStrInput(Request.Form("txtName")) objPerson.Nick = CheckStrInput(Request.Form("txtNick")) objPerson.Mobile = CheckStrInput(Request.Form("txtMobile")) objPerson.Tel = CheckStrInput(Request.Form("txtTel")) objPerson.Email = CheckStrInput(Request.Form("txtEmail")) objPerson.QQ = CheckStrInput(Request.Form("txtQQ")) objPerson.Company = CheckStrInput(Request.Form("txtCompany")) If Not objPerson.AddToXml(objXml) Then ' 呼叫Cls_Person類別的AddToXml方法,新增資料AddErr strErr, objPerson.GetLastError Else AddErr strErr, "新增成功" Response.Write "<script language=""javascript"">opener.location.reload();</script>" End If End If End If Set objXml = Nothing %> <HTML> <HEAD> <TITLE><% = C_TITLE %></TITLE> <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=GB2312"/> <link rel="stylesheet" href="contact.css" type="text/css"> <script language="javascript"> <!-- function CheckForm() { return true; } //--> </script> </HEAD> <BODY> <% = strErr %> <div class="title">新增聯絡資訊</div> <form name="form1" method="post" action="add.asp" onsubmit="return CheckForm()"> <table align="center" width="100%" cellspacing="1" cellpadding="2" border="0" bgcolor="#666600"> <tr bgcolor="#ffffff"> <td width="25%" bgcolor="#e5e5e5" align="right"><b>姓名:</b></td> <td width="75%"><input type="text" name="txtName" size="25" class="input" value="<%=CheckStrOutput(objPerson.Name)%>"></td > </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>英文名:</b></td> <td><input type="text" name="txtNick" size="25" class="input" value="<%=CheckStrOutput(objPerson.Nick)%>"></td> </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>手機:</b></td> <td><input type="text" name="txtMobile" size="25" class="input" value="<%=CheckStrOutput(objPerson.Mobile)%>"></td> </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>電話:</b></td> <td><input type="text" name="txtTel" size="25" class="input" value="<%=CheckStrOutput(objPerson.Tel)%>"></td> </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>Email:</b></td> <td><input type="text" name="txtEmail" size="25" class="input" value="<%=CheckStrOutput(objPerson.Email)%>"></td> </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>QQ:</b></td> <td><input type="text" name="txtQQ" size="25" class="input" value="<%=CheckStrOutput(objPerson.QQ)%>"></td> </tr> <tr bgcolor="#ffffff"> <td bgcolor="#e5e5e5" align="right"><b>所在公司:</b></td> <td><input type="text" name="txtCompany" size="25" class="input" value="<%=CheckStrOutput(objPerson.Company)%>"></td> </tr> </table> <br> <div align="center"> <input type="submit" name="btnOk" value="提交"> <input type="button" name="btnClose" value="關閉" onclick="javascript:return window.close();"> </div> </form> </BODY> </HTML> <% Set objPerson = Nothing %> |