• JavaScript入门经典(第四版)文摘


    第一章  JavaScript与Web概述

    解释型语言:javascript,vbscript

    编译型语言: vb,c++

    第二章  数据类型与变量

    数据类型:

    数值,文本,布尔

    变量区分大小写,变量名不能包含%,&,保留字

    var i = 1;

    ++i 和 i++ 的区别

    prompt("aaaa",55)用法

    转义字符 \xB0 

    parseInt(),parseFloat(),isNaN() 是否是数值

    var myArray = new Array();

    多维数组:

    var personnel = new Array();
    
    personnel[0] = new Array();
    personnel[0][0] = "Name0";
    personnel[0][1] = "Age0";
    personnel[0][2] = "Address0";
    
    personnel[1] = new Array();
    personnel[1][0] = "Name1";
    personnel[1][1] = "Age1";
    personnel[1][2] = "Address1";
    
    personnel[2] = new Array();
    personnel[2][0] = "Name2";
    personnel[2][1] = "Age2";
    personnel[2][2] = "Address2";

    第三章 决策,循环和函数

     比较运算符,逻辑运算符, "A" < "B"  为true, "a" > "B" 为true

     for语句和while语句

    var degFahren = new Array(212, 32, -459.15);
    var degCent = new Array();
    var loopCounter;
    
    for (loopCounter = 0; loopCounter <= 2; loopCounter++)
    {
       degCent[loopCounter] = 5/9 * (degFahren[loopCounter] - 32);
    }
    
    for (loopCounter = 2; loopCounter >= 0; loopCounter--)
    {
       document.write("Value " + loopCounter + " was " + degFahren[loopCounter] + 
                      " degrees Fahrenheit");
       document.write(" which is " + degCent[loopCounter] + 
                      " degrees centigrade<BR>");
    }

    for ....in  循环

    var index;
    for(index in array)
    {
        array[index];
    }

    第四章 常见错误,调试和错误处理

    常见的错误

    1.未经定义的变量

    2.区分大小写

    3.不匹配的大括号

    4.不匹配的圆括号

    5.赋值而不是相等

    6.将方法和属性混为一谈  (传递函数后面没有开闭括号)

    7.在连接字符串时未使用加号(+)

    a.抛出错误

       try
        {
            if (window.top.calcFactorial == null)
                throw "This page is not loaded within the correct frameset";
            if (document.form1.txtNum1.value == "")
                throw "!Please enter a value before you calculate its factorial";
            if (isNaN(document.form1.txtNum1.value))
                throw "!Please enter a valid number";
            if (document.form1.txtNum1.value < 0)
                throw "!Please enter a positive number";
    
            document.form1.txtResult.value =
             window.parent.calcFactorial(document.form1.txtNum1.value);
        }
        catch(exception)
        {
            if (typeof(exception) == "string")
            {
                if (exception.charAt(0) == "!")
                {
                    alert(exception.substr(1));
                    document.form1.txtNum1.focus();
                    document.form1.txtNum1.select();
                }
                else
                {
                    alert(exception);
                }
            }
            else
            {
                alert("The following error occurred " + exception.message);
            }
        }

    b.嵌套的try..catch语句

    c.finally子句

    调试:

    在firefox中firebug

    在IE中调试

    在safari中调试

    使用opera的dragonfly

    第五章 JavaScript-------基于对象的语言

    内置对象类型:

    String对象

    1.length属性

    2.indexOf(),lastIndexOf()

    3.substr(),substring()

    4.toLowerCase(),toUpperCase()

    5.charAt(),charCodeAt(),fromCharCode()

    Array对象

    1.length属性

    2.concat()

    3.slice()

    4.join()

    5.sort()

    6.reverse()

    Math对象

    1.abs()

    2.min(),max()

    3.ceil(),floor()

    4.round()

    5.random()

    6.pow()

    Number对象

    toFixed()

    Date对象

    第6章 浏览器程序设计

    window 对象

    history 对象

    location 对象 replace(),href

    navigator 对象

    screen 对象

    document 对象

    第7章 HTML表单:与用户交互

    第8章 窗口和框架

    第9章 字符串操作

    split(),replace(),search(),match()

    第10章 日期,时间和计时器

    第11章 使用cookie存储信息

    第12章 动态html和w3c文档对象模型

    第13章 在javascript中使用activex和插件

    第14章  ajax

    第15章 javascript框架

  • 相关阅读:
    js用8421码实现10进制转2进制
    什么?toggle(fn1, fn2)函数在1.9版本jq被移除? 来来来,自己撸一个
    js获取鼠标点击的对象,点击另一个按钮删除该对象
    html5小结
    iphone状态栏高度?
    制作手机相册 全屏滚动插件fullpage.js
    js 相关知识整理(一)
    css 居中问题
    进度条
    @Html.Raw()
  • 原文地址:https://www.cnblogs.com/smileberry/p/2607121.html
Copyright © 2020-2023  润新知