直接上代码: 1、测试xml数据 <?xml version="1.0" encoding="utf-8" ?><tbinformbsaverate><informbsaverate><id>1</id> <savingmethod>灵活存入</savingmethod> <savebeginterm>0</savebeginterm> <saveendterm>0</saveendterm> <typeid>1</typeid> <type>活期储蓄</type> <effectdate>2008-12-23</effectdate> <rate>0.50</rate> </informbsaverate><tbinformbsaverate>2、具体实现
<script type="text/javascript" src="css/jquery-1.4.2.min.js"></script><script type="text/javascript" src="css/Components.js"></script><script language="javascript" type="text/javascript">
$(function() {
if ($.browser.mozilla) {
var optionsHtml = null;
var oSaveEndterm = null;
var oTypeID = 5;
var xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.async = false;
xmlDoc.load("data/RMBSaveRate.xml");
$("#ddlSaveTerm").empty();
$(xmlDoc).find('INFORMBSAVERATE').each(function(i) {
if ($(this).children("TYPEID").text() == oTypeID) {
oSaveEndterm = $(this).children("SAVEENDTERM").text();
optionsHtml = '<option value="' + oSaveEndterm + '">' + GetPerior(oSaveEndterm) + '</option>';
$('#ddlSaveTerm').append(optionsHtml);
}
});
}
else {
$("#xmlRMBSaveRate").attr("ondatasetcomplete", function() {
$("#ddlSaveTerm").empty();
ComSaveTime($("#ddlSaveTerm")[0], 5, window.xmlRMBSaveRate.XMLDocument);
$("#ddlSaveTerm")[0].selectedIndex = 0;
});
}
});
</script><meta name="GENERATOR" content="MSHTML 8.00.6001.19170" />
<div class="Total">
<div class="Title">
<div class="Content">通过本计算器可以对每次支取利息金额和初始存入金额进行计算。其中到期本息金额为本金与最后一次支取利息金额之和(已扣除利息税)。</div>
</div>
<div class="Detail">
<div class="Content1">
<table class="DataList" cellspacing="1" cellpadding="0">
<tbody>
<tr class="Item">
<td class="Texttd">储蓄存期 </td>
<td class="TdLeft"><font face="宋体"><select id="ddlSaveTerm" class="Select180" tabindex="1001" name="SaveTerm"></select></font> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<xml id="xmlRMBSaveRate" type="application/xml" src="data/RMBSaveRate.xml" async="false"></xml>