Javascript
JAVA   Netscape   Livescript   Javascript   Navigator   ECMAScript• <script language=javascript>• <script language=script>
7      =,+=,-=,*=,/=,%=    (+,-,*,/,++,--)    (>,<,<=,>=,==,===,!=)    (||,&&,!)
========null == undefinednull === undefined
(a = 2)(2+2*3)(2==3)
switchwhilefordo whilebreakcontinue
funciton
function myFunction(params){  //}var myFunction = function(params){  //}window.addEventLister(“load”, function(){ //
ECMA-262:            Attribute                        Method
(native object)Object , Functon, Number, String.....          (built-in object)Math Global (isNaN, isFinite)          (hos...
var car     = new Object();car.color = “red”;car.doors = 4;car.showColor = function(){     alert(this.color);}
carfunction createCar(){   var car     = new Object();   car.color = “red”;   car.doors = 4;   car.showColor = function(){...
function createCar(color, doors){   var car = new Object();   car.color = color;   car.doors = doors;   car.showColor = fu...
function createCar(color, doors){   this.color = color;   this.doors = doors;   this.showColor = function(){       alert(t...
javascript         javascriptString                  String.prototype         String           trim()String.prototype.trim...
function Car(){}Car.prototype.name = “          ”;Car.prototype.doors = 4;Car.prototype.color = “blue“;Car.prototype.showC...
function Car(){}Car.prototype.name = “         ”;Car.prototype.doors = 4;Car.prototype.color = “blue“;Car.prototype.driver...
functon Car(name, color, doors){   this.color = color;   this.doors = doors;   this.name = name;   this.drivers = new Arra...
JSONvar Car = function(name, color, doors){   return {      name : name,      doors : doors,      drivers : [“a”, “b”],   ...
stringnumber    (   )boolean       true    falsenull                 null
Javascript           (object-based)             (event-driven)(Event)                   (Event Driver)
(                  )           (                      ,                 window       ,XMLHttpRequest    )           (     ...
<input type=”button” onclick=”alert(1)” /><script for=”button1” event=”onclick”language=”javascript”>alert(1)</script>
var el = document.getElementById(“button1”);el.onclick = function(){alert(1)}
onClickonChangeonSelectonFocusonBluronLoadonUnload
http://www.w3schools.com/js/default.asphttp://www.ecmascript.org/index.php
THS!
Javascript 基础
Javascript 基础
Javascript 基础
Javascript 基础
Javascript 基础
Upcoming SlideShare
Loading in...5
×

Javascript 基础

1,099
-1

Published on

Published in: Technology
1 Comment
1 Like
Statistics
Notes
  • cool
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
1,099
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
40
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Javascript 基础

    1. 1. Javascript
    2. 2. JAVA Netscape Livescript Javascript Navigator ECMAScript• <script language=javascript>• <script language=script>
    3. 3. 7 =,+=,-=,*=,/=,%= (+,-,*,/,++,--) (>,<,<=,>=,==,===,!=) (||,&&,!)
    4. 4. ========null == undefinednull === undefined
    5. 5. (a = 2)(2+2*3)(2==3)
    6. 6. switchwhilefordo whilebreakcontinue
    7. 7. funciton
    8. 8. function myFunction(params){ //}var myFunction = function(params){ //}window.addEventLister(“load”, function(){ //
    9. 9. ECMA-262: Attribute Method
    10. 10. (native object)Object , Functon, Number, String..... (built-in object)Math Global (isNaN, isFinite) (host object)window, document
    11. 11. var car = new Object();car.color = “red”;car.doors = 4;car.showColor = function(){ alert(this.color);}
    12. 12. carfunction createCar(){ var car = new Object(); car.color = “red”; car.doors = 4; car.showColor = function(){ alert(this.color); }}var car_one = createCar();
    13. 13. function createCar(color, doors){ var car = new Object(); car.color = color; car.doors = doors; car.showColor = function(){ alert(this.color); }}var car_one = createCar(“red”, 4)var car_two = createCar(“blue”, 2)car_one.showColor(); //show redcar_two.showColor();//show blue
    14. 14. function createCar(color, doors){ this.color = color; this.doors = doors; this.showColor = function(){ alert(this.color); }}var car_one = createCar(“red”, 4)var car_two = createCar(“blue”, 2)car_one.showColor(); //show redcar_two.showColor();//show blue
    15. 15. javascript javascriptString String.prototype String trim()String.prototype.trim = function(){
    16. 16. function Car(){}Car.prototype.name = “ ”;Car.prototype.doors = 4;Car.prototype.color = “blue“;Car.prototype.showColor = function(){
    17. 17. function Car(){}Car.prototype.name = “ ”;Car.prototype.doors = 4;Car.prototype.color = “blue“;Car.prototype.drivers = new Array(“a”, “b”)Car.prototype.showColor = function(){ alert(this.color);}var car_one = new Car();var car_two = new Car();car_one.drivers.push(“c”);alert(car_one.drivers); / show a, b, c /alert(car_two.drivers); / show a, b, c /
    18. 18. functon Car(name, color, doors){ this.color = color; this.doors = doors; this.name = name; this.drivers = new Array(“a”, “b”);}Car.prototype.showColor=function(){ alert(this.color);}
    19. 19. JSONvar Car = function(name, color, doors){ return { name : name, doors : doors, drivers : [“a”, “b”], showColor : function(){ alert(this.color); } }}
    20. 20. stringnumber ( )boolean true falsenull null
    21. 21. Javascript (object-based) (event-driven)(Event) (Event Driver)
    22. 22. ( ) ( , window ,XMLHttpRequest ) ( )
    23. 23. <input type=”button” onclick=”alert(1)” /><script for=”button1” event=”onclick”language=”javascript”>alert(1)</script>
    24. 24. var el = document.getElementById(“button1”);el.onclick = function(){alert(1)}
    25. 25. onClickonChangeonSelectonFocusonBluronLoadonUnload
    26. 26. http://www.w3schools.com/js/default.asphttp://www.ecmascript.org/index.php
    27. 27. THS!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×