<script type=
"text/javascript">
var x = "<floor id='STM_000003_A_1_1' name='郑州南阳路中心一楼'><ftotal title='总坐席数'></ftotal><fused title='已用席数'></fused><fidel title='空闲坐席数'></fidel><fratio title='席数率'></fratio><frest title='休息人数'></frest><fresting title='正在休息人数'></fresting><fapplyrest title='正在申请休息人数'></fapplyrest><fstateMap title='各种状态的人数'>0:21|1:32|2:87|3:23</fstateMap><seatList><component id='sc001' type='column'><group id='1' direction='left'><seat id='21' state='0' remarks='座位1'/></group></component></seatList><summay><stateColorInfo>stateColorInfo</stateColorInfo><floorInfo>floorInfo</floorInfo><seatStateInfo>seatStateInfo</seatStateInfo></summay></floor>";
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(x);
var stateColorInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/stateColorInfo").childNodes[0].nodeValue;
var floorInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/floorInfo").childNodes[0].nodeValue;
var seatStateInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/seatStateInfo").childNodes[0].nodeValue;
alert(stateColorInfo);
alert(floorInfo);
alert(seatStateInfo);
</script>
var x = "<floor id='STM_000003_A_1_1' name='郑州南阳路中心一楼'><ftotal title='总坐席数'></ftotal><fused title='已用席数'></fused><fidel title='空闲坐席数'></fidel><fratio title='席数率'></fratio><frest title='休息人数'></frest><fresting title='正在休息人数'></fresting><fapplyrest title='正在申请休息人数'></fapplyrest><fstateMap title='各种状态的人数'>0:21|1:32|2:87|3:23</fstateMap><seatList><component id='sc001' type='column'><group id='1' direction='left'><seat id='21' state='0' remarks='座位1'/></group></component></seatList><summay><stateColorInfo>stateColorInfo</stateColorInfo><floorInfo>floorInfo</floorInfo><seatStateInfo>seatStateInfo</seatStateInfo></summay></floor>";
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(x);
var stateColorInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/stateColorInfo").childNodes[0].nodeValue;
var floorInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/floorInfo").childNodes[0].nodeValue;
var seatStateInfo = xmlDoc.documentElement.selectSingleNode( "/floor/summay/seatStateInfo").childNodes[0].nodeValue;
alert(stateColorInfo);
alert(floorInfo);
alert(seatStateInfo);
</script>
本文转自 leizhimin 51CTO博客,原文链接:http://blog.51cto.com/lavasoft/466642,如需转载请自行联系原作者