【发布时间】:2017-12-28 20:41:17
【问题描述】:
我对 html 很陌生,对一般的编码也很陌生。我知道这是基本的,但我发现根据我的需要调整别人的代码比仅仅通过教程学习更快。
我想创建一个货币兑换网站。我想选择一种货币,输入金额,然后看看我能得到多少英镑作为回报。
我的代码;
function Converter(){
if (document.converter.currency.value = EUR)
document.converter.pound.value = document.converter.ammount.value * 0.9
if (document.converter.currency.value = USD)
document.converter.pound.value = document.converter.ammount.value * 0.6
}
<form name="converter">
<table border="0">
<tr>
<td>
<select name = "currency">
<option value="EUR" selected> Euro </option>
<option value="USD">Dollar</option></select>
</td>
<td>
<input type="text" name="ammount" onChange="Converter()" />
</td>
</tr>
<tr>
<td>£:</td>
<td><input type="text" name="pound" disabled /></td>
</tr>
</table>
</form>
我想知道这是否是正确的方法,主要是如何在 javascript 中引用选择菜单。
感谢您的宝贵时间!
【问题讨论】:
标签: java html select menu reference