通过 class 定位元素 (dom api)
var el = document.getelementbyid(‘ction1’);
el.focus();
var els = document.getelementsbytagname(‘p’);
els[0].focus();
var els = document.getelementsbyclassname(‘ction’);
els[0].focus();
通过类似 css 选择器的语法定位元素 (lectors api)
var els = document.querylectorall(“ul li:nth-child(odd)”);
var els = document.querylectorall(“table.test > tr > td”);
// u localstorage for persistent storage
// u ssionstorage for per tab storage
textarea.addeventlistener(‘keyup’, function () {
window.localst开学感想作文orage[‘value’] = area.value;
window.localsto台州海洋世界rage[‘timestamp’] = (new date()).gettime();
}, fal);
textarea.value = window.localstorage[‘value’];
var db = window.opendataba(“da朋友过生日送什么taba name”, “databa version”);
db.transaction(function(tx) {
tx.executesql(“lect * from test”, [], successcallback, errorcallback);
});
manifest=”cache-manifest”>
window.applicationcache.addeventlistener(‘checking’, updatecachestatus, fal);
cache manifest
main.js:
var worker = new w托马斯罗宾逊orker(‘extra_work.js’);
worker.onmessage = function (event) { alert(event.data); };
extra_work.js:
// do some work; when done post message.
postmessage(some_data);
var socket = new websocket(location);
socket.onopen = function(event) {
socket.postmessage(“hello, websocket”);
}
socket.onmessage = function(event) { alert(event.data); }
socket.onclo = function(event) { alert(“clod”); }
if (window.webkitnotifications.checkpermission() == 0) {
// you can pass any url as a parameter
window.webkitnotifications.createnotification(tweet.picture, tweet.title,
tweet.text).show();
} el {
window.webkitnotifications.requestpermission();
}
document.addeventlistener(‘dragstart’, function(event) {
event.datatransfer.tdata(‘text’, ‘customized text’);
event.datatransfer.effectallowed = ‘copy’;
西游日记}, fal);
即将支持: 从桌面拖动文件到页面。
if (navigator.geolocation) {
navigator.geolocation.getcurrentposition(function(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
map.tcenter(new glatlng(lat, lng), 13);
map.addoverlay(new gmarker(new glatlng(lat, lng)));
});
}
本文发布于:2023-04-03 02:36:48,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/c1b022f210d46e060e60695d93ebdd46.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:HTML5新特性汇总.doc
本文 PDF 下载地址:HTML5新特性汇总.pdf
留言与评论(共有 0 条评论) |