beginning jquery---1

来源:互联网 发布:windows光盘怎么安装 编辑:程序博客网 时间:2024/04/30 13:00

第一章都是关于javascript的‘

》Using javascript on a webpage:

     1'  直接在添加script tag ,<script type = "text/javascript">   .........   </javascript>

      2' 写到一个.js的javascript file里,通过<script  type = "text/javascript"  src= "path/to/your/file.js"> </script>调用。

》HTMLfile 里,有两个地方来调用外部的JS文件

      1‘在head里

       2’是before the closing </body> tag(!he browser renders the page from top to bottom, and when it comes across             your scripts, it pauses rendering the page to load in your JS. Thus, the page loads slower).

》所有variable用var来定义,命名可以用字母,数字,下划线,但是........数字不可以开头,javascript常用          camelCase(驼峰      式)方法书写。变量类型之间可以任意转换,数组里面定义也可以既有数字又有字符串。var           squares = [1, 4, 9, 16, 25];            var mixed = [1, "Jack", 5, true, 6.5, "Franklin"];

》使用工具-->www.jsconsole.com/-->console( 对于简单的可以用jsconsole最上面直接用     alert)。 http://www.cnblogs.com/see7di/archive/2011/11/21/2257442.html里提到“Firebug内置一个console对象,提供5种方法,用来显示信息。最简单的方法是console.log(),可以用来取代alert()或document.write()。
》对于数组var classMates = ["Jack", "Jamie", "Rich", "Will"];,用push增加元素,var classMates.push(""catherine);添加到最后。

0 0
原创粉丝点击