模拟考试1111

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品</title>
    <script src="js/jquery-3.1.1.min.js"></script>
    <style>
        table{
            width: 550px;
            border-collapse: collapse;
        }
        #head1{
            width: 100px;
        }
        #head2{
            width: 150px;
        }
        #head4{
            width: 150px;
        }
        th{
            height:30px;
            margin: 0px;
            text-align: center;
            border:1px solid black;
        }
        td{
            height:100px;
            margin: 0px;
            text-align: center;
            border:1px solid black;
        }
        img{
            width:90px;
            height: 90px;
        }
        a{
            color: #00ff00;
        }
        a:hover{
            color: #ff0000;
        }
    </style>
    <script>
        $(function(){
            $("#search").click(function(){
                $.ajax({
                    url:"http://114.67.241.121:8080/product/list",
                    type:"get",
                    success:function(result){
                        alert("success");
                        console.log(result);
                        for(var i=0;i<$(result.data).length;i++){
                            $("#table1").append("<tr><td>"+"<img src=\"http://114.67.241.121:8080/img/"+result.data[i].image+"\">"+"</td><td>"+
                                result.data[i].brand+"</td><td>"+
                                "<a target=\"_blank\" href=\"http://114.67.241.121:8080/img/"+result.data[i].image+"\">"+result.data[i].model+"</a>"+"</td><td>"+
                                result.data[i].price+"</td></tr>")
                        }
                        $("tr:eq(4)").css("background","#ffffd0")
                    },
                    error:function(){
                        alert("error")
                    },
                })
            })
        })
    </script>
</head>
<body>
<div><input type="text" id="product" placeholder="请输入产品名称"> <input type="button" id="search" value="搜索"></div>
<div id="product">
    <table id="table1">
        <tr>
            <th id="head1"></th>
            <th id="head2">品牌</th>
            <th id="head3">型号</th>
            <th id="head4">价格</th>
        </tr>
    </table>
</div>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值