-
<!doctype html> <html lang=en> <head> <title></title> <meta charset=utf-8> </head> <body></body> </html>
- 结构化元素
<head><nav><hgroup><footer><article><section> <time datetime=2014-06-08 pubdate>2014-06-08</time>
- contentEditable=true 让文档可编辑document.designMode='on'
- 将文本设为粗体 document.execCommand('bold')
- <input type=email/url/date/time/datetime/month/weeknumber/range/rel/search/color/>
<input type=number min=1 max=5 step=2> <input list=mylist><datalist id=mylist><option value=one></option><option value=two></option><option value=three></option></datalist>
placeholder autofocus autocomplete multiple required parttern
- 判断属性 'autofocus' in document.createElement('input')
- 数据存储 sessionStorage创建的数据只有在那些窗口可用,知道窗口关闭,localStorage是基于域的,可跨域在打开的所有窗口.getItem方法返回的数据为字符串,所以如果存储一个对象,实际是[Object Object],可通过JSON.parse(obj)处理
- 遍历存储对象
for(var i=0;i<sessionstorage.length;i++){ sessionstorage.getItem(sessionstorage.key(i)) }
- 删除数据 sessionstorage.removeItem(key)
- websql数据库 默认为sqllite
打开创建数据var db =opendatebase('mydb','1.0','my database','10*1024*1024')
- 创建表需要在事物中执行
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.geolationif(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