SlideShare uma empresa Scribd logo
1 de 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!

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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)
 

Mais de 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
 

Último

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Javascript 基础

Notas do Editor

  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