我想知道此脚本是否正确尝试使用单选按钮将文本从一个框复制到另一个框以激活该功能。因为它不适合我。它们是两种不同的形式,我不知道这是否重要。它们只是文本框,我希望将“总计”表单中的数据复制到“利润”表单中。
<script type="text/javascript">
function data_copy()
{
if(document.TOTALS.copy[0].checked){
document.profit.SOLDTO1.value=document.TOTALS.SOLDTO.value;
document.profit.['ACCNT#1'].value=document.TOTALS.ACCNT#.value;
document.profit.INVNUM1.value=document.TOTALS.INVNUM.value;
document.profit.SLM1.value=document.TOTALS.SLM.value;
document.profit.totfaccost1.value=document.TOTALS.totfaccost.value;
document.profit.tot_frt_cost1.value=document.TOTALS.tot_frt_cost.value;
document.profit.totlandcost1.value=document.TOTALS.totlandcost.value;
}else{
document.profit.SOLDTO1.value="";
document.profit.['ACCNT#1'].value="";
document.profit.INVNUM1.value="";
document.profit.SLM1.value="";
document.profit.totfaccost1.value="";
document.profit.totlandcost1.value="";
}
}
</script>
Click to fill out profit analysis<input type="radio" name=copy value='yes' onclick="data_copy()";>
最佳答案
这个:
document.profit.ACCNT#1.value="";
是一个语法错误。尝试:
document.profit['ACCNT#1'].value = "";
您引用的两个地方都需要修复。
关于javascript - 尝试在模糊或单击时将数据从一个文本框复制到另一个文本框不起作用javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7841972/