1 / 13

Introduction to HTML5 Programming

Introduction to HTML5 Programming. d onghao. HTML5 is the New HTML Standard. New Elements, Attributes. Full CSS3 Support Video and Audio 2D/3D Graphics Local Storage Local SQL Database Web Applications. HTML Elements and jQuery. HTML Elements <div>, <p>, <body>, <span>, etc. CSS

iniko
Download Presentation

Introduction to HTML5 Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to HTML5 Programming donghao

  2. HTML5 is the New HTML Standard • New Elements, Attributes. • Full CSS3 Support • Video and Audio • 2D/3D Graphics • Local Storage • Local SQL Database • Web Applications

  3. HTML Elements and jQuery • HTML Elements • <div>, <p>, <body>, <span>, etc. • CSS • Styling HTML elements. • border-radius, gradient, etc. • jQuery • A Javascript library to manipulate HTML elements efficiently. • $("p.neat").addClass("ohmy").show("slow");

  4. Graphics • Canvas • Use Javascript to draw graphics on the fly. • Bitmap graphics. • http://www.w3.org/TR/2dcontext/ • SVG (Scalable Vector Graphics) • Define graphics in XML format. • Attributes can be animated. • Can attach event handlers. • Vector graphics. • http://www.w3.org/TR/SVG/

  5. Graphics / Canvas • <canvas id="canvas" width="200" height="100"></canvas> • var canvas = document.getElementById("canvas"); • var context = canvas.getContext("2d"); • context.beginPath(); • context.moveTo(0, 0); • context.lineTo(100,100); • context.strokeStyle = "black"; • context.stroke();

  6. Graphics / SVG • <?xml version="1.0" standalone="no"?> • <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> • <svgxmlns="http://www.w3.org/2000/svg" version="1.1"> • <circlecx="100" • cy="50" • r="40" • stroke="black" • stroke-width="2" • fill="red" /> • </svg>

  7. Data Storage • Cookies • Use the jQuery-Cookies plugin. • $.cookie("key", value, { expires: 10 }); • var value = $.cookie("key"); • Local Storage • Store data in the browser. • About 5M, depends on browser's setting. • localStorage['key'] = value;

  8. Client-Server Communication • AJAX: AsynchronousJavascript And XML • jQuery syntax:$.ajax(options) • http://api.jquery.com/jQuery.ajax/ • Data format: • Plain text. • XML • JSON: JavaScript Object Notation

  9. Asynchronous Programming • Javascript is Single threaded. • Synchronous: • Start job A. • Wait until A is finished. • Do job B. • Asynchronous: • Start job A, register callback for A. • Do job B.

  10. Asynchronous Example • // define a callback function. • varcallback = function(txt) { • alert("Got text:" + txt); • }; • // start fetching data. • $.get("example.txt", callback); • alert("Next job.");

  11. JSON: Javascript Object Notation • http://www.json.org • Good way to exchange data. • Serialization: Object <-> String.

  12. Other Cool Stuff • Mustache • Template engine. • Template + Data => HTML. • D3: Data Driven Documents • http://d3js.org • Bind data to HTML elements. • Tutorial: • http://mbostock.github.com/d3/tutorial/circle.html

  13. Reading List • http://www.w3schools.com/html5 • http://jquery.com • http://www.w3.org/TR/2dcontext/ • http://www.w3.org/TR/SVG/ • http://www.json.org • http://mustache.github.com • http://d3js.org

More Related