zoukankan      html  css  js  c++  java
  • 知识点

    document====è文档

    get========è获取

    element=====è元素

    by=========è通过

    id=========è名字

    document.getElementById(“id”)通过id名获取元素节点

    window.onload=function(){}//当文档加载完成后执行该函数

    document.getElementsByTagName(“类名”)通过标签类名获取全部元素

    sele.onchange=====è下拉菜单被改变事件

    parentNode=======è父节点

    children=========è所有的孩子节点可以通过下标取某个孩子

    document.creatElement(“类名”)=è创建元素节点

    appendChild======è添加孩子节点(默认放在最后)

    insertBefore(插入的节点,参照的节点)è把创建的节点放在某个节点后面

     

    var da = document.getElementById("xiongda");

    demo.removeChild(da);=è移出节点

     

      getAttribute(属性)      获取属性    

       通过这个方法,可以得到某些元素的  某些属性

     

    setAttribute(“属性”,”值”);

        比如说,我们想要把一个类名  改为   demo 

       div.setAttribute(“class”,”demo”); 

    fotate(30deg)=è旋转30

     

    button  不可以用       disabled  不可用的意思

    btn.disabled = “disabled”     ||   btn.disabled = true;

     

    setInterval(fn,5000);      每隔 5秒钟,就去执行函数fn一次

     setTimeout(fn,5000);     5秒钟之后,去执行 fn 函数,只执行一次

     

    JS 页面跳转: window.location.href = http://www.itcast.cn ;

    arguments.callee代替函数名本身

     

    encodeURIComponent() 函数可把字符串作为 URI 组件进行编码

    decodeURIComponent() 函数可把字符串作为 URI 组件进行解码

    var url = "http://www.cdhq.cn?name=andy";

    console.log(encodeURIComponent(url));  // 编码

    var afterUrl = encodeURIComponent(url);

    console.log(decodeURIComponent(afterUrl));  // 解码

     

     

    缓动动画公式:

    leader = leader + (target - leader ) /10 ;

     

    offsetWidth    offsetHeight

    得到对象的宽度和高度(自己的,与他人无关)

     

    offsetLeft  offsetTop   

    返回距离上级盒子(最近的带有定位)左边的位置

    如果父级都没有定位则以body 为准

     

    event事件

    data  返回拖拽对象的URL字符串(dragDrop

    width     该窗口或框架的高度

    height    该窗口或框架的高度

    pageX    光标相对于该网页的水平位置(ie无)

    pageY    光标相对于该网页的垂直位置(ie无)

    screenX  光标相对于该屏幕的水平位置

    screenY  光标相对于该屏幕的垂直位置

    target    该事件被传送到的对象

    type  事件的类型

    clientX   光标相对于该网页的水平位置(当前可见区域)

    clientY   光标相对于该网页的水平位置

     

    防止选择文字的拖动:

    window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();

     

    document.head    

      document.body

      document.title 

    没有 document.html  取而代之的是  document.documentElement;

     

    页面滚动事件:

    window.onscroll = function()

     

    scrollTop    scrollLeft

    它就是当你滑动滚轮浏览网页的时候网页隐藏在屏幕上方的距离

    兼容性写法:

     var scrollTop = window.pageYOffset || document.documentElement.scrollTop

    || document.body.scrollTop || 0;

     

    client  可视区域   

        offsetWidth:   width  +  padding  +  border     (披着羊皮的狼) 

        clientWidth width  +  padding      不包含border 

    scrollWidth:   大小是内容的大小  

     

    window.onscroll  = function() {}  屏幕滚动事件

      window.onresize = function() {}  窗口改变事件

    你好!如果你有什么更好的建议或意见,请在评论区留言。感谢你的阅读!
  • 相关阅读:
    通过反射将一个java对象的属性值转换为一个Map
    反射中的 Method 的 getReadMethod 与 getWriteMethod 使用 【获取一个对象的所有属性字段名称和其对应的值】
    maven项目无法导入Oracle的jdbc连接jar包【我】
    史上最全最详细JNDI数据源配置说明
    启动eclipse导致Tomcat的配置文件重置
    各种集合key,value能否为null
    CentOS系统使用yum安装配置MariaDB数据库
    Unity导出webPlayer并且部署到IIS
    unity web项目发布服务器Data file is corrupt (not a Unity W
    Unity3d Web Player 的server端联网配置
  • 原文地址:https://www.cnblogs.com/YCxiaoyang/p/7282062.html
Copyright © 2011-2022 走看看