本周任务总结

本周小结

跳转页面
  • meta标签跳转

<!-- 只刷新不跳转 -->` `<meta http-equiv="refresh" content="5">` `<!-- 定时转到其他页面 -->` `<meta http-equiv="refresh" content="5";url="../html/login.html">

  • a标签直接跳转

<a href="地址值">文字</a>

  • js实现

    *// 直接跳转*

    window.location.href='index.html';

    *// 定时跳转*

    setTimeout("javascript:location.href='index.html'", 5000);

  • html跳转上一页的方式:window.history.go(-1);或window.history.back(-1);
    <a href=”#” onClick=”JavaScript :history.back(1);”>返回上一页</a>
    <a href=”#” onClick=”javascript :history.Go(-1);”>返回上一页</a>

var和let的区别:
  • 作用域不同

1.使用var声明的变量,其作用域为该语句所在的函数内,且存在变量提升现象;
2.使用let声明的变量,其作用域为该语句所在的代码块内,不存在变量提升;
3.let不允许在相同作用域内,重复声明同一个变量。

  • 变量提升

var命令会发生”变量提升“现象,即变量可以在声明之前使用,值为undefined。

let命令则不同,它所声明的变量一定要在声明后使用,否则报错。

将该行数据放到input框里
<stript>
 获取html里的节点
var inputDishName = document.getElementById('inputDishName');
var inputDishPrice = document.getElementById('inputDishPrice');
var inputDishDesc = document.getElementById('inputDishDesc');
var inputDishType = document.getElementById('inputDishType');
foodChangeE是修改按钮绑定的函数
function foodChangeE(e) {
    console.log(e, '1111');
    console.log("修改功能");
    modifyPop[0].style.display = "flex";
    将e中的变量赋给相应的inpu框
    inputDishName.value= e.name,
    inputDishPrice.value=e.price,
    inputDishDesc.value= e.desc,
    inputDishType.value= e.type
}
</script>
input搜索框的实现
<body>
    <div class="container">
        <input type="text" id="val" placeholder="搜索">
        <input type="button" value="按钮" id="btn">
        <div class="show"></div>
    </div>
</body>
<script>
    function inputSearch(arr) {
        let str = "";
        const val = document.querySelector("#val");
        const show = document.querySelector(".show");
        val.onkeyup = function () {
            str = "";
            show.style.display = "block";
            const value = val.value.trim();
            arr.forEach((item) => {
                if (value.length == 0) {
                    return show.style.display = "none"
                }
                let res = item.indexOf(value);
                if (res != -1) {
                    str += "<p>" + item + "</p>"
                }
            })
            show.innerHTML = str;
        }
        show.addEventListener('click', function (e) {
            console.log(e.target)
            val.value = e.target.innerText
            show.style.display = "none";

        })

    }
    const arr = ["二手手机", "苹果手机", "手表", "手环", "华为手机", "三星手机"]
    inputSearch(arr)
</script>

下周计划

  1. 独立写一套系统的增删改查功能,细节到位
  2. 完成下一阶段学习计划,弥补一下落下的课程
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值