用原生js实现商品表单筛选查询功能_document

需求分析

1.能够根据价格搜索出对应的商品;
2.能够根据商品名称查询出对应商品;
在这里插入图片描述

实现效果

1.在这里插入图片描述
2.
在这里插入图片描述

源代码
<style>
  .search{
    margin: 0 auto;
    margin-bottom:10px;
  }
  input{
    width: 50px;
  }
  table,table tr th, table tr td { border:1px solid #000; }
  table { width: 500px; min-height: 25px; line-height: 25px; text-align: center; border-collapse: collapse; padding:2px;}   
</style>

<body>
  <div class="search">
    按照价格查询:<input type="text" class="start">- <input type="text" class="end">
    <button class="search-price">搜索</button>按照商品名称查询:
    <input type="text" class="product">
    <button class="search-name">查询</button>
  </div>
  <table>
    <thead>
      <tr>
        <th>id</th>
        <th>产品名称</th>
        <th>价格</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
  </table>

<script>
   var data = [{
    id:1,
    pname:'小米',
    price:1000
   },
   {
    id:2,
    pname:'华为',
    price:2000
   },
   {
    id:3,
    pname:'荣耀',
    price:3999
   },
   {
    id:4,
    pname:'诺基亚',
    price:7000
   }];
   //1.先获取相应是元素
   var tbody = document.querySelector('tbody');
   var search_price = document.querySelector('.search-price');


# 总结

谈到面试,其实说白了就是刷题刷题刷题,天天作死的刷。。。。。

为了准备这个“金三银四”的春招,狂刷一个月的题,狂补超多的漏洞知识,像这次美团面试问的算法、数据库、Redis、设计模式等这些题目都是我刷到过的

**并且我也将自己刷的题全部整理成了PDF或者Word文档(含详细答案解析)**

![我的美团offer凉凉了?开发工程师(Java岗)三面结束等通知...](https://img-blog.csdnimg.cn/img_convert/43fb1052f1ae2825b671b7d67c756e9f.webp?x-oss-process=image/format,png)

66个Java面试知识点

**架构专题(MySQL,Java,Redis,线程,并发,设计模式,Nginx,Linux,框架,微服务等)+大厂面试题详解(百度,阿里,腾讯,华为,迅雷,网易,中兴,北京中软等)**

![我的美团offer凉凉了?开发工程师(Java岗)三面结束等通知...](https://img-blog.csdnimg.cn/img_convert/fff6e7e937f37fc0a93dbb0917c19236.webp?x-oss-process=image/format,png)

**算法刷题(PDF)**

![我的美团offer凉凉了?开发工程师(Java岗)三面结束等通知...](https://img-blog.csdnimg.cn/img_convert/f08abbb105f81341bef6e58d9149e30c.webp?x-oss-process=image/format,png)

)**

[外链图片转存中...(img-5bfNwzUd-1721836948441)]

**算法刷题(PDF)**

[外链图片转存中...(img-2s0GGsE4-1721836948442)]

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值