SoFunction
Updated on 2025-04-14

Example drill ASP+XML programming is relatively complete page 2/2

<% Option Explicit 
'*********************************************** 
' Instructions: 37080308 Address Book
' Author: gwd 2002-11-05
'*********************************************** 
%> 

<!--#include file="pub/"--> 
<!--#include file="pub/"--> 
<!--#include file="pub/"--> 
<!--#include file="pub/class/"--> 

<% 
 Dim objXml, objPerson 
 Dim strErr 

 Set objXml = ("") 
Set objPerson = New Cls_Person ' Generate Cls_Person object
 If ("btnOk") <> "" Then 
If LoadXmlDoc(objXml, C_XMLFILE, False, strErr) Then ' Load XML file
'Assign values ​​to the corresponding attribute
  = CheckStrInput(("txtName")) 
  = CheckStrInput(("txtNick")) 
  = CheckStrInput(("txtMobile")) 
  = CheckStrInput(("txtTel")) 
  = CheckStrInput(("txtEmail")) 
  = CheckStrInput(("txtQQ")) 
  = CheckStrInput(("txtCompany")) 
If Not (objXml) Then ' Calling the AddToXml method of the Cls_Person class to add data
AddErr strErr,  
 Else 
AddErr strErr, "Added Successfully"
 "<script language=""javascript"">();</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="" type="text/css"> 
<script language="javascript"> 
<!-- 
function CheckForm() 

 return true; 

//--> 
</script> 
</HEAD> 
<BODY> 
<% = strErr %> 
<div class="title">Add contact information</div>
<form name="form1" method="post" action="" 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>Name:</b></td>
 <td width="75%"><input type="text" name="txtName" size="25" class="input" value="<%=CheckStrOutput()% 
>"></td> 
</tr> 
<tr bgcolor="#ffffff"> 
<td bgcolor="#e5e5e5" align="right"><b>English name:</b></td>
 <td><input type="text" name="txtNick" size="25" class="input" value="<%=CheckStrOutput()%>"></td> 
</tr> 
<tr bgcolor="#ffffff"> 
<td bgcolor="#e5e5e5" align="right"><b>Mobile phone:</b></td>
 <td><input type="text" name="txtMobile" size="25" class="input" value="<%=CheckStrOutput()%>"></td> 
</tr> 
<tr bgcolor="#ffffff"> 
<td bgcolor="#e5e5e5" align="right"><b>Tel:</b></td>
 <td><input type="text" name="txtTel" size="25" class="input" value="<%=CheckStrOutput()%>"></td> 
</tr> 
<tr bgcolor="#ffffff"> 
. redd bgcolor="#e5e5e5" align="right"><b>Email:</b></td>
 <td><input type="text" name="txtEmail" size="25" class="input" value="<%=CheckStrOutput()%>"></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()%>"></td> 
</tr> 
<tr bgcolor="#ffffff"> 
<td bgcolor="#e5e5e5" align="right"><b>Company:</b></td>
 <td><input type="text" name="txtCompany" size="25" class="input" value="<%=CheckStrOutput()%>"></td> 
</tr> 
 </table> 
 <br> 
 <div align="center"> 
<input type="submit" name="btnOk" value="submit">
<input type="button" name="btnClose" value="close" onclick="javascript:return ();">
 </div> 
</form> 
</BODY> 
</HTML> 
<% 
Set objPerson = Nothing 
%>