美文网首页
2018-09-25-day6总结

2018-09-25-day6总结

作者: fanzl | 来源:发表于2018-09-25 20:49 被阅读0次

选择器

a>b---父子
a~b{}-兄弟选择器
a+b{}--相邻兄弟
a[b=c]--属性

样式冲突:

就近原则---具体性原则(id>类>标签[]>标签>通配符)----重要性原则(!important)

JavaScript=ECMAScript(js语法规范)+BOM(浏览器对象模型)+DOM
ECMAScript(js语法规范)
BOM(浏览器对象模型)--window
DOM(文档对象模型)---document

<div id="login">
    <form  action="" method="post" >
        <fieldset>------制框
            <legend>用户登录</legend>-----------框标题
            <p id="p1">
                <label for="username">用户名:</label>-----为 input 元素定义标注(标记)
                <input type="text" name="username" id="user" value="" />
            </p>
            <p id="p2">
                <label for="password">密码:</label>
                <input type="password" name="pass" id="pass" value="" />
            </p>
            <p id="p3">
                <label for="email">邮箱:</label>
                <input type="email" name="email" id="email" value="" />
            </p>
            <input type="submit" name="" id="" value="登录" />
        </fieldset>
                
    </form>
</div>

内置函数提取时间


                var now=new Date()---新建对象保存时间
                var year=now.getFullYear()-----得到年份
                var month=now.getMonth()-----月
                var date=now.getDate()----------日
                var hour=now.getHours()--------时
                var minute=now.getMinutes()-------分
                var second=now.getSeconds()------秒
                var day=now.getDay()----------------星期几
                var div=document.getElementById("time")

str.substring(1)--------str的从下标1开始到最后的子串
str.charAt(0)------------str的下标为0的字符
======================================================
docume.getElementsByTagName("h1")[0]---根据标签名拿到标签(返回列表)
document.getElementById("h1")---根据id拿到标签
docume.getElementsByClassName(".fo")[0]----根据类名拿标签(返回列表)
docume.querySelector("#h1"/".fo")---根据选择器拿
docume.querySelectorAll(".fo")[0]---根据选择器拿多个(返回列表)
==========================================================windw.location---浏览器地址栏
windw.document---文档对象
windw.history----历史记录
windw.navigator--浏览器
windw.screen-----屏幕

相关文章

网友评论

      本文标题:2018-09-25-day6总结

      本文链接:https://www.haomeiwen.com/subject/dgnloftx.html