为了账号安全,请及时绑定邮箱和手机立即绑定
慕课网数字资源数据库体验端
JavaScript进阶篇_学习笔记_慕课网
为了账号安全,请及时绑定邮箱和手机立即绑定

JavaScript进阶篇

慕课官方号 页面重构设计
难度入门
时长 8小时55分
  • 本页教学内容有误!
    split()方法的第二个参数是表示,按照分割符分割后 从左到右 显示的数组个数

    查看全部
  • string.split(separator,limit)

    参数值

    separator可选。字符串或正则表达式,从该参数指定的地方分割 string Object。
    limit可选。该参数可指定返回的数组的最大长度。如果设置了该参数,返回的子串不会多于这个参数指定的数组。如果没有设置该参数,整个字符串都会被分割,不考虑它的长度。


    查看全部
  • <!doctype html>

    <html>

    <head>

    <title>new document</title>

    <meta charset="utf-8"/>

    <meta name="keywoders" content="xxx"/>

    <meta name="description" content="xxx"/>

    <style>

    *{

    padding:0px;

    margin:0px;

    font:12px normal "microsoft yahei";

    }

    #tabs{

    width:290px;

    padding:5px;

    height:150px;

    mardin:20px;

    }

    #tabs ul{

    display:block;

    list-style-type:none;

    height:30px;

    line-height:30px;

    border-bottom:2px saddlebrown solid;

    }

    #tabs ul li{

    background:#fff;

    cursor:pointer;

    float:left;

    list-style:none;

    height:28px;

    line-height:28px;

    margin:0px 3px;

    border:1px solid #aaaaaa;

    border-bottom;none;

    display:inline-block;

    width:60px;

    text-align:center;

    }

    #tabs ul li.on{

    border-top:2px solid saddlebrown;

    border-bottom:2px solid #fff;

    }

    #tabs div{

    height:120px;

    line-height:25px;

    border:1px solid #336699;

    border-top:none;

    padding:5px;

    }

    .hide{

    display:none;

    }

    </style>

    <script>

    window.onload=function(){

    var oTab=document.getElementById("tabs");

    var oUl=oTab.getElementsByTagName("ul")[0];

    var oLis=oUl.getElementsByTagName("li");

    var oDivs=oTab.getElementsByTagName("div");

    for(var i=0;i<oLis.length;i++){

    oLis[i].index=i;

    oLis[i].onclick=function(){

    for(var n=0;n<oLis.length;n++){

    oLis[n].className="";

    oDivs[n].className="hide";

    }

    this.className="on";

    oDivs[this.index].className="";

    }

    }

    }

    </script>

    </head>

    <body>

    <div id="tabs">

    <ul>

    <li class="on">房产</li>

    <li>家居</li>

    <li>二手房</li>

    </ul>

    <div>

    275万购昌平邻铁三居 总价20万买一居

    200万内购五环三居 140万安家东三环

    北京首现零首付楼盘 53万购东5环50平

    京楼盘直降5000 中信府 公园楼王现房  

    </div>

    <div class="hide">

    40平出租屋大改造 美少女的混搭小窝

    经典清新简欧爱家 90平老房焕发新生

    新中式的酷色温情 66平撞色活泼家居

    瓷砖就像选好老婆 卫生间烟道的设计

    </div>

    <div class="hide">

    通州豪华3居260万 二环稀缺2居250w甩

    西3环通透2居290万 130万2居限量抢购

    黄城根小学学区仅260万 121平70万抛!

    独家别墅280万 苏州桥2居优惠价248万

    </div>

    </div>

    </body>

    </html>


    查看全部
    0 采集 收起 来源:编程挑战

    2018-09-18

  • myarray[5]=88;

    只需使用下一个未用的索引,任何时刻可以不断向数组增加新元素。

    查看全部
  • var myarr=new Array()   建立数组  空数组

    查看全部
  • 1.文本框的值由外部输入,使用parseInt();

    2.document.getElementById("id"),()中的id需要使用"",

    查看全部
    0 采集 收起 来源:编程练习

    2018-09-18

  • 1.字符串中第一个字符的下标是 0。最后一个字符的下标为字符串长度减一(string.length-1)。

    2.如果参数 index 不在 0 与 string.length-1 之间,该方法将返回一个空字符串。


    查看全部
  • get/setTime() 返回/设置时间,单位毫秒数,计算从 1970 年 1 月 1 日零时到日期对象所指的日期的毫秒数。

    查看全部
  • JavaScript中还有很多这样的操作符,例如,算术操作符(+、-、*、/等),比较操作符(<、>、>=、<=等),逻辑操作符(&&、||、!)。

    查看全部
  • 100%7是取余运算,100%7就是100/7的余数  100/7=14在余2,所以100%7=2

    查看全部
    0 采集 收起 来源:编程练习

    2018-09-18

  • <!doctype html>

    <html>

    <head>

    <title>new document</title>

    <meta charset="utf-8"/>

    <meta name="keywoders" content="xxx"/>

    <meta name="description" content="xxx"/>

    </head>

    <body>

    <script>

    window.onload=function(){

    Highlight();

    }

    function Highlight(){

    var b=document.getElementById("table").lastChild;

    var trs=b.getElementsByTagName("tr");

    for(var i=1;i<trs.length;i++){

    trs[i].onmouseover=function(){

    this.style.backgroundColor="#f2f2f2";

    }

    trs[i].onmouseout=function(){

    this.style.backgroundColor="#fff";

    }

    }

    }

    function addOne(obj){

    var tbody=document.getElementById("table").lastChild;

    var tr=document.createElement("tr");

    var td=document.createElement("td");

    td.innerHTML="<input type='text'/>";

    tr.appendChild(td);

    td=document.createElement("td");

    td.innerHTML="<input type='text'/>";

    tr.appendChild(td);

    td=document.createElement("td");

    td.innerHTML="<a href='javascript:;' onclick='deleteRow(this)'>删除</a>";

    tr.appendChild(td);

    tbody.appendChild(tr);

    Highlight();

    }

    function deleteRow(obj){

    var tbody=document.getElementById('table').lastChild;

    var tr=obj.parentNode.parentNode;

    tbody.removeChild(tr);

    }

    </script>

    <table border="1" width="50%" id="table">

    <tr>

    <th>学号</th>

    <th>姓名</th>

    <th>操作</th>

    </tr>

    <tr>

    <td>xh001</td>

    <td>王小明</td>

    <td><a href="javascript:;" onclick="deleteRow(this)">删除</a></td>

    </tr>

    <tr>

    <td>xh002</td>

    <td>刘小芳</td>

    <td><a href="javascript:;" onclick="deleteRow(this)">删除</a></td>

      </tr>  

    </table>

    <input type="button" value="添加一行" onclick="addOne()"/>

    </body>

    </html>


    查看全部
    0 采集 收起 来源:编程练习

    2018-09-17

  • var 可以定义各种类型
    查看全部
  • 100%7:为100/7的余数值。100/7=100除以7的值.

    a++ 和 ++a的相同点都是给a+1,不同点是a++是先参加程序的运行再+1,而++a则是先+1再参加程序的运行。

    查看全部
    0 采集 收起 来源:编程练习

    2018-09-17

  • (数组).length

    查看全部
  • 变量不用加“”,字符串得加“”

    var num1=10;
    var num2="JS";

    查看全部

举报

0/150
提交
取消
课程须知
你需要具备HTML、css基础知识,建议同学们也可以想学习下js入门篇,快速认识js,熟悉js基本语法,更加快速入手进阶篇!
老师告诉你能学到什么?
通过JavaScript学习,掌握基本语法,制作简单交互式页面
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!