我下面的脚本在返回值中显示了太多的小数点
另外,当我将代码发布到我的网站上时,它没有显示我添加的所有文本样式
你能告诉我我错过了什么吗?
谢谢
<html>
<head>
<style>
body {color:rgb(128,128,128);}
p.3 {color:rgb(128,128,128);}
p.3 {font-size:20PX;}
</style>
<script type = "text/javascript">
function convert() {
var Amount=document.getElementById('amount');
var Currency=document.getElementById('currency');
var Converted=document.getElementById('converted');
var Choice=document.getElementById('choice');
var AED=1;
var US=0.27;
var QR=0.99;
var SR=1.02;
var KD=0.0778;
var BD=0.102;
switch(document.converter.currency.value) {
case "US Dollars" :
document.converter.converted.value=US*document.converter.amount.value;
document.converter.choice.value=document.converter.currency.value;
break;
case "Qatar Riyal":
document.converter.converted.value=QR*document.converter.amount.value;
document.converter.choice.value=document.converter.currency.value;
break;
case "Saudi Riyal":
document.converter.converted.value=SR*document.converter.amount.value;
document.converter.choice.value=document.converter.currency.value;
break;
case "Kuwaiti Dinar":
document.converter.converted.value=KD*document.converter.amount.value;
document.converter.choice.value=document.converter.currency.value;
break;
case "Bahrain Dinar":
document.converter.converted.value=BD*document.converter.amount.value;
document.converter.choice.value=document.converter.currency.value;
break;
}
}
</script>
</head>
<body>
<div id="divWrapper">
<form name="converter" id="converter">
<br/> Enter amount in UAE Dirhams
<input name="amount"type="text" id="amount" size="3" />
<br /><br />
Please Select a currency <select name="currency" id="currency">
<option>Select one</option>
<option value="US Dollars">US Dollars</option>
<option value="Qatar Riyal">Qatar Riyal</option>
<option value="Saudi Riyal">Saudi Riyal</option>
<option value="Kuwaiti Dinar">Kuwaiti Dinar</option>
<option value="Bahrain Dinar">Bahrain Dinar</option>
</select>
<input type="button" name="convt" id="convt" onclick="convert()" value="Convert" />
<br /><br />
<p class="3"> The amount is:
<input name="converted" type="text" id="converted" style="border:0px" style="color:rgb(255,0,102)" style="text-align:center" style="font-size:22PX" value="" size="5"/>
in
<input name="choice" type="text" id="choice" style="border:0px" style="color:rgb(255,0,102)" style="font-size:22PX" style="text-align:center" value="" size="10"> </p>
<br /><br />
</form>
</div>
</body>
</html>