html5用户指南

  1. <!doctype html> <html lang=en> <head> <title></title> <meta charset=utf-8> </head> <body></body> </html>
  2. 结构化元素<head><nav><hgroup><footer><article><section> <time datetime=2014-06-08 pubdate>2014-06-08</time>
  3. contentEditable=true 让文档可编辑document.designMode='on'
  4. 将文本设为粗体 document.execCommand('bold')
  5. <input type=email/url/date/time/datetime/month/weeknumber/range/rel/search/color/>
    <input type=number min=1 max=5 step=2>
  6. <input list=mylist><datalist id=mylist><option value=one></option><option value=two></option><option value=three></option></datalist>

  7. placeholder autofocus autocomplete multiple required parttern

  8. 判断属性 'autofocus' in document.createElement('input')
  9. 数据存储 sessionStorage创建的数据只有在那些窗口可用,知道窗口关闭,localStorage是基于域的,可跨域在打开的所有窗口.getItem方法返回的数据为字符串,所以如果存储一个对象,实际是[Object Object],可通过JSON.parse(obj)处理
  10. 遍历存储对象for(var i=0;i<sessionstorage.length;i++){ sessionstorage.getItem(sessionstorage.key(i)) }
  11. 删除数据 sessionstorage.removeItem(key)
  12. websql数据库 默认为sqllite
    打开创建数据var db =opendatebase('mydb','1.0','my database','10*1024*1024')
  13. 创建表需要在事物中执行var db;if(window.openDatabase){ db=opendatebase('mydb','1.0','my database','10*1024*1024'); db.transaction(function(tx){ tx.executesql('create table is not exists sf(id,date,text)'); tx.executesql('insert into sf (id,date,text) values(?,?,?),[2,2014,"test"]') }) }
    14.geolation
    if(nabigator.geolocation){ navigator.geolocation.getcurrentPostion(function(position){ var coords=position.coords; showMap(coords.latitude,coords.longitude,coords.accuracy) }) }

http://levi.cg.am/archives/1920
http://www.feeldesignstudio.com/2011/01/html5-tutorial-1

猜你喜欢

转载自www.cnblogs.com/homehtml/p/12985519.html