HTML5

11
Introduction with Examples HTML5 ttp://msitrsu.somee.com

description

HTML5. http://msitrsu.somee.com. Introduction with Examples. S lides http://slides.html5rocks.com G et Location http://html5demos.com/geo I mage Gallery http://www.apple.com/html5/showcase/gallery More: http://www.apple.com/html5 - PowerPoint PPT Presentation

Transcript of HTML5

Page 1: HTML5

Introduction with Examples

HTML5http://msitrsu.somee.com

Page 2: HTML5

HTML5 Examples

• Slides http://slides.html5rocks.com

• Get Location http://html5demos.com/geo

• Image Gallery http://www.apple.com/html5/showcase/galleryMore: http://www.apple.com/html5

• Canvas Video http://craftymind.com/factory/html5video/CanvasVideo.html

• Animation http://mrdoob.com/91/Ball_Pool

• Game http://www.kesiev.com/akihabara/demo/game-capman.html

• Interactive Comic http://www.­nevermindthebull­ets.­com

Page 3: HTML5

แหล่�งเรี�ยนรี� �ศึ�กษา HTML5 ด้�วยตั�วเอง• ข้�อมู�ล่ Web­browser ที่��รี �น HTML5­ได้�• http://www.html5.in.th• เรี��มูตั�น เข้�ยน HTML5• http://www.blognone.com/topics/html5• http://html5demos.com/• เรี��มูตั�น เข้�ยน HTML5­ ด้�วย Dreamweaver­CS5• HTML­Standard• http://www.w3schools.com/html5/html5_reference.asp• http://www.designil.com• http://html5inth.com/­

Click for Reference

Page 4: HTML5
Page 5: HTML5

<div id=“header”>

<div id=“nav”>

<div id=“article”>

<div id=“footer”>

<div id=“aside”><div id=“section”>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><body><div id=“header”>­­­­­­­­­­<h1>header</h1></div><div id=“header”>­­­­­­­­­­­<a­href=“home.html”>Home</a>­­­­­­­­­­­<a­href=“about.html”>About</a></div><div id=“article”>­­­­­­­­­­<h1>Article­title..</h1>­­­­­­­­­­<p>Text…..</p></div><div id=“section”>­­­­­­­­­­­<p>Section1</p></div><div id=“aside”>­­­­­­­­­­­<p>About­us…<p></div><div id=“footer”>­­­­­­­­­­­<p>All­rights­received</p></div></body></html>

HTML4 Page layout:

Page 6: HTML5

<header> Defines a header for a section or page

<nav> Defines navigation links

<aside> Defines content aside from the page content

<article> Defines an article

<section> Defines­a­section

<footer> Defines a footer for a section or page

<header>

<nav>

<article>

<footer>

<aside><section>

<!DOCTYPE HTML><html><body><header>­­­­­­­­­­<h1>Title</h1></header><nav>­­­­­­­­­­­<a­href=“home.html”>Home</a>­­­­­­­­­­­<a­href=“about.html”>About</a></nav><article>­­­­­­­­­­<h1>Article­title..</h1>­­­­­­­­­­<p>Text…..</p></article><section>­­­­­­­­­­­<p>Section1</p></section><aside>­­­­­­­­­­­<p>About­us…<p></aside><footer>­­­­­­­­­­­<p>All­rights­received</p></footer></body></html>

HTML5 Page layout:

Page 7: HTML5

HTML5 Code วี�ดี�โอ<video­id="video"­src="http://www.teerapuch.com/demo/HTML5/videotag/song.mp4"­autoplay­controls></video>

Audio + Video เล่�นเสี�ยง แล่ะ สีดีงวี�ดี�โอ

HTML5 Code เสี�ยง<audio­id="audio"­src="http://slides.html5rocks.com/src/rushus-modal_blues.mp3"­controls></audio>

Page 8: HTML5

JavaScript Code

<script>­­­­var­files­=­document.querySelectorAll('.dragout');­­­­for­(var­i­=­0,­file;­file­=­files[i];­++i)­{­­­­­­­­file.addEventListener('dragstart',­function­(e)­{­­­­­­­­­­­­e.dataTransfer.setData('DownloadURL',­this.dataset.downloadurl);­­­­­­­­},­false);­­­­}</script>

Drag File to Desktop ดี�งไฟล่�จากเวี�บมาไวี�ในเครื่��อง

HTML5 Code<a­href="http://slides.html5rocks.com/src/star.mp3"­draggable="true"­class="dragout"­data-downloadurl­=­"audio/mpeg:star.mp3:http://slides.html5rocks.com/src/star.mp3">.mp3­file</a>

Page 9: HTML5

Canvas Element ใช้�ในการื่วีาดีภาพ เช้�น สี��เหล่��ยม ทรื่งกล่ม

HTML5 Code<canvas­id="myCanvas"­width="200"­height="100"></canvas>

JavaScript Code ทรื่งกล่ม<script>­­­­­­var­c=document.getElementById("myCanvas");­­­­­var­ctx=c.getContext("2d");­­­­­ctx.fillStyle="#FF0000";­­­­­ctx.beginPath();­­­­­ctx.arc(70,18,15,0,Math.PI*2,true);­­­­­ctx.closePath();­­­­­ctx.fill();</script>

JavaScript Code สี��เหล่��ยม

<script>­­­­­­var­c=document.getElementById("myCanvas");­­­­­­var­cxt=c.getContext("2d");­­­­­­cxt.fillStyle="#FF0000";­­­­­­­­­­cxt.fillRect(0,0,150,75);</script>

Page 10: HTML5

ContentEditable แก�ไข Content โดียการื่คล่&กท��ข�อควีาม แล่ะสีามารื่ถแก�ไขแล่�วี save ท(นท�HTML5 Code

<section id="editable" contenteditable="true">   <p>Testing ContentEditable </p></section>

JavaScript Code<script>var editable = document.getElementById('editable');addEvent(editable, 'blur', function () {  localStorage.setItem('contenteditable', this.innerHTML);  document.designMode = 'off';});addEvent(editable, 'focus', function () {  document.designMode = 'on';});addEvent(document.getElementById('clear'), 'click', function () {  localStorage.clear();  window.location = window.location; // refresh});if (localStorage.getItem('contenteditable')) {  editable.innerHTML = localStorage.getItem('contenteditable');}</script>

Page 11: HTML5

Possibly!.. Because:1. is­not­completed.2. Not­fully­browser­support.

How can we move forward ?• It­is­a­good­time­for­learning.• Build­web­pages­HTML4/XHTML­+­html5­+­JS• Building­browser-specific­apps.• Focusing­on­the­mobile.

Is it possible to build sites on HTML5 now?