白银价格转换器(美元/盎司->人民币/克)

<!DOCTYPE html>   
<html>   
   <head>   
     <title>白银转换器 BY [email protected]</title>   
     <meta charset="utf-8" />   
	 <style>
		body{
		
		}
	</style>
	 <script>
			var url = "http://api.liqwei.com/currency/?exchange=USD|CNY&count=";
			var YSTOG = 31.1035;
			function changeIt(){
				var price = document.getElementById('silverPrice').value;
				if(price){
					var result = parseFloat(price)/YSTOG;
					document.getElementById("result").src= url+result;
				}
				document.getElementById('silverPrice').select();
				document.getElementById('silverPrice').focus();
			}
	</script>
   </head>   
   <body onload="document.getElementById('silverPrice').focus()">
	
	白银美元价格(美元/盎司):
	<input type="text" name="silverPrice" id="silverPrice"/>  
	<input type="button" name="转换(人冥币/克)" value="转换(人冥币/克)" onclick="changeIt()" />
	<br/><br/>
	结果:
	<br/><br/>
	
	<iframe id="result" name="result" frameBorder="0" style="margin:0;padding:0;"></iframe>
	
	</body>
</html>   

把上面代码存成html格式,用浏览器打开即可使用,方便快捷! 

你可能感兴趣的:(html,function,浏览器,url,input,button)