我试图在元素之间复制一些值但不起作用。怎么了?!这两行运行良好 document.getElementById('ftreturnslbl').style.display = 'block'; document.getElementById('ftasc1primoritorno').style.display = 'block';
function ff_returnasc1primo_action(element, action)
{
switch (action) {
case 'click':
document.getElementById('ftreturnslbl').style.display = 'block';
document.getElementById('ftasc1primoritorno').style.display = 'block';
document.getElementById('toftasc1primoreturn').value =
document.getElementById('fromftasc1primo').value;
document.getElementById('fromftasc1primoreturn').value = document.getElementById('toftasc1primo').value;
break;
default:;
}
}
此代码适用于所有常见浏览器。
我不知道您的错误在哪里或您的 html 是什么样的,但这是我理解的最少情况。
function copy(){
var fromValue = document.getElementById('from').value;
var returnValue = document.getElementById('return').value;
document.getElementById('to').value = fromValue;
document.getElementById('toReturn').value = returnValue;
}
document.getElementById('copyBtn').addEventListener('click',copy);
<div>from:</div>
<div>
<input id="from"><input id="return">
</div>
<div>to:</div>
<div>
<input id="to"><input id="toReturn">
</div>
<button id="copyBtn">
Copy
</button>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句