• jQuery


    1.window.onload与$(document).ready()的对比

      window.onload $(document).ready()
    执行时机 必须等待网页中所有的内容加载完毕后(包括图片、Flash、视频等)才能执行 网页中所有DOM文档结构回执完毕后即刻执行,可能与DOM元素关联的内容(图片、Flash、视频等)并没有加载完
    编写个数

    同一个页面不能同时编写多个,执行以下代码:

    window.onload=function(){alert("小明爱学习");}

    window.onload=function(){alert("小明爱学习");}

    结果只会输出一次“小明爱学习”

    同一个页面能同时编写多个,执行以下代码:

    $(document).ready(function(){alert("小明爱学习");};)

    $(document).ready(function(){alert("小明爱学习");};)

    结果是输出两次“小明爱学习”

    简化写法 可以简写成$(function(){});

    2.

    js 设置css
    dom.style.属性名="属性值";
    dom.style.cssText={"键1":"值1","键2":"值2"};


    <style type="text/css">
    </style>
    dom.className="";

    jquery设置css

    jquery对象 .addClass(样式名);

    $(this).css({"background":"#c81623","font-size":"red"});

  • 相关阅读:
    whereis which type find
    souce and bash 的区别
    systemctl daemon-reload
    linux /etc/profile bashrc bash_profile
    ulimt 和 sysctl
    MySQL 问题总结
    asyncio
    Linux 中 MySQL 操作
    总结一波 Redis 面试题
    os 模块 和 re 模块
  • 原文地址:https://www.cnblogs.com/alexanderthegreat/p/7073213.html
Copyright © 2020-2023  润新知