日期:2014-05-17  浏览次数:20918 次

呵呵!写了一个在html页面实现增加.删除.修改管理员的例子,还请大家指教
asp页面就不用发了


-----------------------------------------=================
<HTML>
<HEAD>
<TITLE> 新增管理员 </TITLE>
<META   http-equiv=Content-Type   content=text/html;   charset=gb2312   charset=gb2312>

<style   type= "text/css ">
<!--
body   {background-color:   #0099FF;}
td,th,a,font   {font-size:   13px;font-family:   Arial,   Helvetica,   sans-serif,   宋体,   宋二体;}
.input   {width:125px;height:20px;}
-->
</style>

<script   language= "Jscript ">

function   GetDataFromServer(sXML,   sURL)
{
var   oXML   =   new   ActiveXObject( "MSXML2.DOMDocument ");
oXML.async   =   false;
oXML.loadXML(sXML);
var   xmlResult   =   PostDataToServer(oXML,   sURL);
return   xmlResult.xml
}

function   GetDataFromServer_obj(sXML,   sURL)
{
var   oXML   =   new   ActiveXObject( "MSXML2.DOMDocument ");
oXML.async   =   false;
oXML.loadXML(sXML);
return   PostDataToServer(oXML,   sURL);
}

function   PostDataToServer(oXML,   sURL)
{
var   oXmlHttp   =   new   ActiveXObject( "Microsoft.XMLHTTP ");
oXmlHttp.Open( "POST ",   sURL   ,   false);
oXmlHttp.Send(oXML);
return   oXmlHttp.responseXML;
}


function   HandleAdmin(thisobj)
{

var   u   =   document.all( "u ").value   ;
var   p   =   document.all( "p ").value   ;
var   t   =   document.all( "t ").value   ;
var   y   ;
if   (u== " "||p== " "||t== " ")
{
alert( "没有输入完整! ")   ;
return   false   ;
}
if   (p!=t)
{
alert( "确认密码输入错误! ")
return   false   ;
}
if   (thisobj.value== "增加 ")
{
y   =   "add "   ;
}
else
{
y   =   "update "   ;
}

var   objDom=   new   ActiveXObject( "Microsoft.XMLDOM ");
var   sURL   =   "AdminXML.asp ";
var   tempXml   =   " <Data> <Resout   Attr= ' "+p+ " '   Type= ' "+y+ " '> "+u+ " </Resout> </Data> ";
var   InXML   =   GetDataFromServer(tempXml,sURL);
if   (objDom.loadXML(InXML))
{
if   (objDom.childNodes(0).getAttribute( "ErrDesc ")== " ")
{
alert( "操作成功! ");
}
else
{
alert(objDom.childNodes(0).getAttribute( "ErrDesc "));
}
}
else
{
alert( "加载服务器端返回的XML文件失败! ");
}

}

function   ShowApply(obj,par)
{
document.all( "u ").value   =   " "   ;
document.all( "p ").value   =   " "   ;
document.all( "t ").value   =   " "   ;

if   (!document.getElementsByTagName( "table "))
{
return &n