如题所说。 我想在 "group1currency1" 里输入一个数据 比如USD,然后点击下面的按钮,将"group1currency1"里的内容复制到”outputcurrency1“。 下面是我的代码,我尝试了很多次都不成功, 希望有人能帮助我
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p> Exchange Rates</P>
<table border="1">
<tr>
<th> </th>
<th>Currency #1</th>
<th>Currency #2</th>
<th>Bid</th>
<th>Ask</th>
</tr>
<tr>
<td><p>Group 1</td>
<td><input type="text" id="group1currency1"size="12" value=""></td>
</tr>
<tr>
<td><p>Group 1</td>
<td><input type="text" id="group2currency1"size="12" value=""></td>
</tr>
<tr>
<td><p>Group 3</td>
<td><span id="outputcurrency1"></td>
</tr>
</table>
<button type="button" id="outputbutton" class="btn btn-success">Output</button>
</div>
<!-- jQuery -->
<script src="js/exchange.js"></script>
</script>
</body>
</html>
这个是我在js文档里的代码
var x= function(){
$("outputbutton").click(function(){
var str=document.getElementById("group1currency1").value;
document.getElementById("outputcurrency1").value = str;
});
};