Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在3列中显示div_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 在3列中显示div

Javascript 在3列中显示div,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我试图以三列中的div格式显示我从数据库中获取的数据,所以我这样做了: <table id="produse"> <thead> <tr> <th class="fluid">First Column</th> <th class="fixed">Fixed Column</th> <th class="

我试图以三列中的div格式显示我从数据库中获取的数据,所以我这样做了:

    <table id="produse">
    <thead>
        <tr>
            <th class="fluid">First Column</th>
            <th class="fixed">Fixed Column</th>
            <th class="fluid">Third Column</th>
        </tr>
    </thead>
    <tbody>
        <tr></tr>
    </tbody>
</table>
function getRow(aparat){

    var row ='<td>'+'<div id="prod">'+
        '<div>'+ '<img src='+aparat.imagine+' width="150" height="80" />' +'</div>'+
        '<div>'+ aparat.nume + '</div>' +                                                    //functia care le aranjeaza
        '<div>'+ aparat.pret +'&nbsplei' + '</div>'+
        '<div>'+'<button type = "button" id = "comanda">'+'Comanda'+'</button>'+'</div>'
        + '</div>'+'</td>';

        return row;
}

第一列
固定柱
第三纵队
在javaScript文件中,我做了如下操作:

    <table id="produse">
    <thead>
        <tr>
            <th class="fluid">First Column</th>
            <th class="fixed">Fixed Column</th>
            <th class="fluid">Third Column</th>
        </tr>
    </thead>
    <tbody>
        <tr></tr>
    </tbody>
</table>
function getRow(aparat){

    var row ='<td>'+'<div id="prod">'+
        '<div>'+ '<img src='+aparat.imagine+' width="150" height="80" />' +'</div>'+
        '<div>'+ aparat.nume + '</div>' +                                                    //functia care le aranjeaza
        '<div>'+ aparat.pret +'&nbsplei' + '</div>'+
        '<div>'+'<button type = "button" id = "comanda">'+'Comanda'+'</button>'+'</div>'
        + '</div>'+'</td>';

        return row;
}
函数getRow(aparat){ 变量行=“”+“”+ ''+ '' +''+ ''+aparat.nume+''+//functia care le Aranjaza '+aparat.pret+' lei'+''+ “+”+“Comanda”+“+” + ''+''; 返回行; }

但是我的产品只有一行,任何解决方案,

你可以使用显示:Flex或显示:内联块,但是不要使用表。这表对布局不好,除非必要,不要考虑使用它们< /P> 检查以下代码片段

div{
显示:内联块;
}

第1列
第2栏
第3栏

我假设您的意思是只在一列(而不是一行)中。您的getRow只有一个
,而不是3。请将此添加到jsonlint中,这样事情就清楚了。最好使用任何形式的模板系统,而不是字符串连接。然后,您可以编写易于查看的HTML并替换其中的标记。这是您想要的吗?