栀八月yu
2022-05-27 10:31
采纳率: 71%
浏览 82
已结题

怎么实现将表格里的数据上传到文本框里?

首先在这加一个上传按钮,然后点击上传,将表格里的数据上传到文本框里,怎么实现?

img

<script type="text/javascript">
//查询热表地址
function QgCcRb(){
    var ckbs=$("#qgInfo input[type=checkbox]:checked");
    if(ckbs.length==0){
        alert("请选择要查询的区管");
        return false;
    }
    if(ckbs.length>1){
        alert("对不起一次只能选择一个");
        return false;
    }
    var id=ckbs.val();
    var Zuhao= $('#Zuhao').val();
    var html ="";
    $.ajax({
        url:"/RbHotPower/QgCon/QgCcRb.action",
        async:false,
        dataType:"json",
        data:{
            "ids":id,
            "zuhao":Zuhao
        },
        success:function(data){
            document.getElementById("aa").style.display="block";
            document.getElementById("xincreate_table_body").style.display="none";
            $("#qgccrbInfo").empty();
            var d=data.qgccrb;
            for(var i=0;i<d.length;i++){
                var id=d[i].id;
                var QgID=d[i].qgCcrb.qgID;
                var Zuhao=d[i].qgCcrb.zuhao;
                var RbAd1=d[i].qgCcrb.rbad1.split(/\F+/)[1];
                var RbAd2 =d[i].qgCcrb.rbad2.split(/\F+/)[1];
                var RbAd3=d[i].qgCcrb.rbad3.split(/\F+/)[1];
                var RbAd4 =d[i].qgCcrb.rbad4.split(/\F+/)[1];
                var RbAd5=d[i].qgCcrb.rbad5.split(/\F+/)[1];
                var RbAd6 =d[i].qgCcrb.rbad6.split(/\F+/)[1];
                var RbAd7=d[i].qgCcrb.rbad7.split(/\F+/)[1];
                var RbAd8 =d[i].qgCcrb.rbad8.split(/\F+/)[1];
                var RbAd9=d[i].qgCcrb.rbad9.split(/\F+/)[1];
                var RbAd10 =d[i].qgCcrb.rbad10.split(/\F+/)[1];
                var RecordTime=d[i].qgCcrb.recordTime;
                if(i%2 == 1){
                    html+= "<tr class='gradeX odd'>";
                }else if(i%2 == 0){
                    html+= "<tr class='gradeX even'>";
                }
                html+="<td class='text-center'><input type='checkbox' name='pchecked'  value='"+QgID+"'/></td>";
                html+="<td class='text-center'>"+QgID+"</td>";
                html+="<td class='text-center'>"+Zuhao+"</td>";
                html+="<td class='text-center'>"+RbAd1+"</td>";
                html+="<td class='text-center'>"+RbAd2+"</td>";
                html+="<td class='text-center'>"+RbAd3+"</td>";
                html+="<td class='text-center'>"+RbAd4+"</td>";
                html+="<td class='text-center'>"+RbAd5+"</td>";
                html+="<td class='text-center'>"+RbAd6+"</td>";
                html+="<td class='text-center'>"+RbAd7+"</td>";
                html+="<td class='text-center'>"+RbAd8+"</td>";
                html+="<td class='text-center'>"+RbAd9+"</td>";
                html+="<td class='text-center'>"+RbAd10+"</td>";
                html+="<td class='text-center'>"+RecordTime+"</td>";
                html+="</tr>";
            }
              html+="</tbody>"
              html+="</table>";
              html+="</div>";
            $("#qgccrbInfo").append(html);
            
        }
    
    
});
    
}


4条回答 默认 最新

相关推荐 更多相似问题