列布局
http://www.w3.org/TR/2001/WD-css3-multicol-20010118/
Canvas画图
http://developer.mozilla.org/en/docs/Drawing_Graphics_with_Canvas
function draw() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 50, 50);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect (30, 30, 50, 50);
}
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
快速返回
Fast back (and forward)
This very experimental feature allows much faster session history navigation. The feature is off by default but can be enabled for testing purposes by setting the browser.sessionhistory.max_viewers preference to a nonzero number.
全部来自:
http://developer.mozilla.org/en/docs/What’s_New_in_Deer_Park_Alpha
目前只有 firefox(1.5)支持,ie和opera(8.5)不行。选取无兄弟节点的节点。
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
定义引号(包括单双引两种)
Quote me!
Quote me again!Quote third times?
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
IE(6.0 sp2)和Firefox(1.5 beta)表现为该表单用 Tab 键无法获得焦点(跳过),opera(8.5) 则不予理睬。
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
英文原文在此:
http://dean.edwards.name/weblog/2005/09/busted/
大意如下:
我们经常使用 window.onload 来处理页面,当页面加载完成做一些事情。但这个 window.onload 是页面全部加载完成,甚至包括图片,而我们实际上经常需要的是文档 DOM 加载完毕!
这是原来的方法。
function init(){
alert("页面加载完毕!");
}
window.onload=init;
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
对于 Mozilla 可以这样
// for Mozilla browsers
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", function(){alert("DOM加载完毕!")}, null);
}
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
对于 IE 浏览器,可以使用IE特有的 defer 属性。
alert("DOM 加载完毕!")
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
非IE浏览器会忽略 defer 而直接执行 script 代码,你可以有两种办法来屏蔽 非IE浏览器。
conditional comments 条件注释
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
alert("DOM 加载完毕!")
/*@end @*/
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
除此之外的浏览器就使用最上面第一个好了。最后一个问题就是要避免 onload 运行多次的问题,加入判断。
function init() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// create the "page loaded" message
var text = document.createTextNode("Page loaded!");
var message = document.getElementById("message");
message.appendChild(text);
};
/* for Mozilla */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", init, null);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("
真是很佩服老外的这种钻研精神,这么个小问题引申出来这么多知识,值得我们好好学习。:(
IE JScript 特有属性。
/*@cc_on @*/
/*@if (@_jscript_version >= 4)
alert("JScript version 4 or better");
@else @*/
alert("You need a JScript version > 4 engine.");
/*@end @*/
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
MSDN 参考地址:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsconconditionalcompilation.asp