代码如下:
<html>
<head>
<meta charset="UTF-8">
<title>汇率换算</title>
</head>
<body>
<select id="field23737">
<!--币种Id -->
<option value="0">人民币 CNY</option>
<option value="1">美元 USD</option>
<option value="2">欧元EUR</option>
<option value="3">日元JPY</option>
<option value="4">港元HKD</option>
<option value="5">英镑GBP</option>
<option value="6">澳元AUD</option>
<option value="7">卢布RUB</option>
<option value="8">韩元KRW</option>
<option value="9">新元SGD</option>
</select>
本次付款金额:<input type="text" id="field23738" />
约人民币:<input type="text" id="field23739" />
<!-- script代码,如果需要引用js文件,请使用与HTML中相同的方式。 -->
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script type="text/javascript">
/*
* TODO
* 请在此处编写javascript代码
*/
/* jQuery(document).ready(function() {
jQuery('#field23738').blur(function() { //付款金额field23738 */
jQuery(document).ready(function() {
jQuery('#field23738').blur(function() { //付款金额field23738
var flag = $("#field23737").val(); //币种
var num = $("#field23738").val(); //输入的金额
if (flag == 0) {
var field23737 = num * 1; //人民币
}
if (flag == 1) {
var field23737 = num * 6.94; //美金
}
if (flag == 2) {
var field23737 = num * 7.87; //欧元
}
if (flag == 3) {
var field23737 = num * 0.06; //日元
}
if (flag == 4) {
var field23737 = num * 0.89; //港币
}
if (flag == 5) {
var field23737 = num * 8.86; //英镑
}
if (flag == 6) {
var field23737 = num * 5.11; //澳元
}
if (flag == 7) {
var field23737 = num * 0.1; //卢布
}
if (flag == 8) {
var field23737 = num * 0.006; //韩元
}
if (flag == 9) {
var field23737 = num * 5.07; //新元
}
$("#field23739").val(field23737);
alert("请核对金额!!!");
});
jQuery("#field23737").blur("blur", function() { //bindPropertyChange
var flag = $("#field23737").val(); //币种
var num = $("#field23738").val(); //输入的金额
if (flag == 0) {
var field23737 = num * 1; //人民币
}
if (flag == 1) {
var field23737 = num * 6.94; //美金
}
if (flag == 2) {
var field23737 = num * 7.87; //欧元
}
if (flag == 3) {
var field23737 = num * 0.06; //日元
}
if (flag == 4) {
var field23737 = num * 0.89; //港币
}
if (flag == 5) {
var field23737 = num * 8.86; //英镑
}
if (flag == 6) {
var field23737 = num * 5.11; //澳元
}
if (flag == 7) {
var field23737 = num * 0.1; //卢布
}
if (flag == 8) {
var field23737 = num * 0.006; //韩元
}
if (flag == 9) {
var field23737 = num * 5.07; //新元
}
$("#field23739").val(field23737);
});
});
</script>
</body>
</html>