| function save(){ if( modifyOrg()=="N") { return; } for(var i=0; i<tbList.rows.length; i++) { var row=tbList.rows[i].cells[0].children[0].rows[0]; var personId=row.cells[1].children[0].value; var seqNo = tbList.rows[i].getAttribute("seqNo"); var staffNode = personDom.selectSingleNode("//peorsone[@seqNo='" + seqNo + "']"); var personCode=row.cells[2].children[0].value; var personName=row.cells[3].children[0].value; var sex=row.cells[4].children[0].value; //alert(staffN;ode ); if(staffNode.getAttribute("isNew") == "Y") { createPerson(CurrNodeId,personCode,personName,sex); } else { var strXML = "<?xml version='1.0' encoding='gb2312'?>" + "<data>" + "<personCode><![CDATA[" + personCode+ "]]></personCode>" + "<personName><![CDATA[" + personName + "]]></personName>" + "<sex><![CDATA[" + sex+ "]]></sex>" + "<personId><![CDATA[" + personId+ "]]></personId>" + "</data>"; //alert(strXML ); var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("POST","Org.jsp?mode=modifyPerson", false); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(strXML ); } } } |
| <?xml version='1.0' encoding='gb2312'?> <tree id="0"> <item child="1" text="组织" id="1" > </item> </tree> |
| <?xml version="1.0" encoding="gb2312"?> //这是定义xml文件的首行。用来指明版本及字符集 <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" language="JavaScript"> //这里定义了stylesheet 元素。并指出其国际命名的组织及语言。 <xsl:template match="/"> <xsl:apply-templates select="peorsones"/> </xsl:template> //上面是匹配的规则。"/"表示从根结开始去匹配。匹配到下面的peorsones标记。这是正则表达式有关的学问。我们只要理解就可以。 <xsl:template match="peorsones"> //当匹配上peorsones时所要做的事情。 <table id="tbList" border="1" width="100%"> //定义一个id为"tbList的表格。此表格是显示在WEB上的 <xsl:for-each select="peorsone"> //循环匹配peorsone <tr> //定义tbList表格的一行,并在行上增加一个叫seqNo的属性名,值为匹配到的seqNo(序号) <xsl:attribute name="seqNo"><xsl:value-of select="@seqNo"/></xsl:attribute> <td> //定义行上的一列,列又去匹配 <xsl:apply-templates select="."/> </td> </tr> </xsl:for-each> </table> </xsl:template> <xsl:template match="peorsone"> <table border="1" width="100%"> <tr> //定义宽为5%的一列,在该列上插入一个checkbox控件 <td width="5%"> <input type="checkbox" value="on" size="10"></input> </td> //定义一个不显示的列,在该列上插入一个text控件,text的值为匹配到的personId(人员Id) <td style="display:none"> <input type="text" size="25"> <xsl:attribute name="value"><xsl:value-of select="personId"/></xsl:attribute> </input> </td> <td width="30%"> <input type="text" size="20"> <xsl:attribute name="value"><xsl:value-of select="personCode"/></xsl:attribute> </input> </td> <td width="40%"> <input type="text" size="40"> <xsl:attributename="value"><xsl:value-of select="personName"/></xsl:attribute> </input> </td> //定义一个width为28%的列,在该列上插入一个下拉列表select 控件,select的值如果匹配到为0时则为"男",1时则为"女" <td width="28%"> <select size="1"> <option value="0"> <xsl:if test=".[sex=0]"> <xsl:attribute name="selected">true</xsl:attribute> </xsl:if> 男 </option> <option value="1"> <xsl:if test=".[sex=1]"> <xsl:attribute name="selected">true</xsl:attribute> </xsl:if> 女</option> </select> </td> //定义一列,在该列上插入一个button控件,onclick 事件为自定义的方法,该方法传递当前单击的按纽 <td width="*"> <button onclick="openPersonRolePage(this)" style="width: 36; height: 21">角色</button> </td> </tr> </table> </xsl:template> </xsl:stylesheet> |