SlideShare a Scribd company logo
1 of 32
Javascript
JAVA

   Netscape

   Livescript

   Javascript

   Navigator

   ECMAScript



• <script language=javascript>
• <script language=script>
7

      =,+=,-=,*=,/=,%=

    (+,-,*,/,++,--)

    (>,<,<=,>=,==,===,!=)

    (||,&&,!)
===

==

===

null == undefined
null === undefined
(a = 2)

(2+2*3)

(2==3)
switch

while

for

do while

break

continue
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)

          (host object)
window, document
var car     = new Object();
car.color = “red”;
car.doors = 4;
car.showColor = function(){
     alert(this.color);
}
car


function createCar(){
   var car     = new Object();
   car.color = “red”;
   car.doors = 4;
   car.showColor = function(){
       alert(this.color);
   }
}
var car_one = createCar();
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 red
car_two.showColor();//show blue
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 red
car_two.showColor();//show blue
javascript


         javascript


String                  String.prototype
         String
           trim()


String.prototype.trim = function(){
function Car(){}

Car.prototype.name = “          ”;


Car.prototype.doors = 4;

Car.prototype.color = “blue“;

Car.prototype.showColor = function(){
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
                           /
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);
}
JSON
var Car = function(name, color, doors){
   return {
      name : name,
      doors : doors,
      drivers : [“a”, “b”],
      showColor : function(){
          alert(this.color);
      }
   }
}
string

number    (   )

boolean       true    false



null                 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)}
onClick

onChange

onSelect

onFocus

onBlur

onLoad

onUnload
http://www.w3schools.com/js/default.asp

http://www.ecmascript.org/index.php
THS!

More Related Content

What's hot

Prototype and angularjs $scopes
Prototype and angularjs $scopesPrototype and angularjs $scopes
Prototype and angularjs $scopes
getOffMyLawn Json
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
philogb
 

What's hot (19)

COMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTMLCOMP2021 Final Project - LightHTML
COMP2021 Final Project - LightHTML
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
The Truth About Lambdas in PHP
The Truth About Lambdas in PHPThe Truth About Lambdas in PHP
The Truth About Lambdas in PHP
 
Some Examples in R.
Some Examples in R.Some Examples in R.
Some Examples in R.
 
Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009
 
Learn java script
Learn java scriptLearn java script
Learn java script
 
Prototype and angularjs $scopes
Prototype and angularjs $scopesPrototype and angularjs $scopes
Prototype and angularjs $scopes
 
Javascript Styles and some tips
Javascript Styles and some tipsJavascript Styles and some tips
Javascript Styles and some tips
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinLet's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to Kotlin
 
Oop php 5
Oop php 5Oop php 5
Oop php 5
 
Михаил Крайнюк. Form api: ajax-commands
Михаил Крайнюк. Form api: ajax-commandsМихаил Крайнюк. Form api: ajax-commands
Михаил Крайнюк. Form api: ajax-commands
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
 
Laravel the right way
Laravel   the right wayLaravel   the right way
Laravel the right way
 
Statements in C
Statements in CStatements in C
Statements in C
 
A practical introduction to Kotlin
A practical introduction to KotlinA practical introduction to Kotlin
A practical introduction to Kotlin
 
Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
 

Viewers also liked (6)

Css101
Css101Css101
Css101
 
Html&Browser
Html&BrowserHtml&Browser
Html&Browser
 
Web encoding 元则
Web encoding 元则Web encoding 元则
Web encoding 元则
 
Javascrpt arale
Javascrpt araleJavascrpt arale
Javascrpt arale
 
The Analysis of Alipay
The Analysis of AlipayThe Analysis of Alipay
The Analysis of Alipay
 
Alipay brings mobile wallet to china's stores
Alipay  brings mobile wallet to china's storesAlipay  brings mobile wallet to china's stores
Alipay brings mobile wallet to china's stores
 

Similar to Javascript 基础

The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
rajivmordani
 

Similar to Javascript 基础 (20)

JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
 
Composition in JavaScript
Composition in JavaScriptComposition in JavaScript
Composition in JavaScript
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Javascript1
Javascript1Javascript1
Javascript1
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
AngularJS Directives
AngularJS DirectivesAngularJS Directives
AngularJS Directives
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Javascript And J Query
Javascript And J QueryJavascript And J Query
Javascript And J Query
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Modular and Event-Driven JavaScript
Modular and Event-Driven JavaScriptModular and Event-Driven JavaScript
Modular and Event-Driven JavaScript
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
 

More from Alipay (11)

学会站在设计的角度做开发
学会站在设计的角度做开发学会站在设计的角度做开发
学会站在设计的角度做开发
 
洞察、创造与想象
洞察、创造与想象洞察、创造与想象
洞察、创造与想象
 
seaJs—不仅仅是脚本加载器
seaJs—不仅仅是脚本加载器seaJs—不仅仅是脚本加载器
seaJs—不仅仅是脚本加载器
 
从小书签到浏览器扩展的应用
从小书签到浏览器扩展的应用从小书签到浏览器扩展的应用
从小书签到浏览器扩展的应用
 
谈谈Javascript设计
谈谈Javascript设计谈谈Javascript设计
谈谈Javascript设计
 
行为化体验度量
行为化体验度量行为化体验度量
行为化体验度量
 
Html基础
Html基础Html基础
Html基础
 
前端本地环境初探
前端本地环境初探前端本地环境初探
前端本地环境初探
 
前端本地环境初探
前端本地环境初探前端本地环境初探
前端本地环境初探
 
重构用户体验
重构用户体验重构用户体验
重构用户体验
 
Js in js
Js in jsJs in js
Js in js
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Javascript 基础

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n