xml文件:
- XML code
<?xml version="1.0" encoding="UTF-8"?> <DiskInfo> <disk> <DiskNO>1</DiskNO> <size>22</size> </disk> <disk> <DiskNO>2</DiskNO> <size>33</size> </disk> <disk> <DiskNO>3</DiskNO> <size>44</size> </disk> </DiskInfo>
html文件
- HTML code
<script> $.ajax({ url:"<?php echo $DaemonPath['DISK_INFO'];?>", type:"POST", dataType: "xml", error: function(xml){ alert('Error loading XML document'+xml); }, success: function(data) { var msg = ''; $(data).find('disk').each(function(){ var DiskNO = $(this).children("DiskNO").text(); var size = $(this).children("size").text(); msg += '<option value="'+DiskNO+'">disk'+DiskNO+'</option>'; }) $('#disk').html(msg); //$('#AllRemainSpace').html($('#disk').val()); $('#disk').click(function(){ //$('#AllRemainSpace').html($('#disk').val()); }); } }); </script> <td width="65%" height="30" align="left" bgcolor="#D9E1E1" style="padding-left:5px;"> <select name="disk" id="disk"> </select> </td> <td height="30" align="left" bgcolor="#D9E1E1" style="padding-left:5px;"><div id="AllRemainSpace"></div></td>
如上当选择对应的DiskNO的时候再“AllRemainSpace”打印出DiskNO对应的size,
请各位大虾帮帮忙啊小弟谢谢了
------解决方案--------------------
纯粹帮顶,不了解Php,不过jquery解析xml的很多例子,楼主可以看看,我的博客中也有例子