点点滴滴(JavaScript)
禁止选择
unselectable="on"(off): IE/Opera
style="-moz-user-select:none": FireFox(JS:element.style.MozUserSelect = "none";)
style="-khtml-user-select:none": Safari(JS:element.style.KhtmlUserSelect)
onselectstart="return false": IE
取消选择
if(document.selection && document.selection.clear) document.selection.clear(); // IE
else if(window.getSelection && window.getSelection().removeAllRanges) window.getSelection().removeAllRanges(); // FireFox/Opera/Safari
当前焦点是哪个控件
document.activeElement // IE, FF3.0+
获取样式的实际属性值
IE: 对象.currentStyle.需要访问的属性
W3C: window.getComputedStyle("对象",null).需要访问的属性(第2个参数为伪元素,如:hover,:first-letter,:before等,是必须的)
function getStyle(element, style){
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle){
strValue = document.defaultView.getComputedStyle(element, "").getPropertyValue(strCssRule);
}
else if(element.currentStyle){
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
return p1.toUpperCase();
});
strValue = element.currentStyle[strCssRule];
}
&
相关文档:
最近这段时间一直在搞前端JavaScript,以前总觉得JS没什么搞头,经过这一段的应用,才发现Js里面的东西真的很深很深的,不然为什么各大门户网站都招一批JS工程师呢。
闲话不说,现在看看JavaScript
里的闭包
。
要成为高级 JavaScript 程序员 ......
个人记录在案,以免遗忘。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
<s ......
nodeName
nodeName 属性含有某个节点的名称。
元素节点的 nodeName 是标签名称
属性节点的 nodeName 是属性名称
文本节点的 nodeName 永远是 #text
文档节点的 nodeName 永远是 #document
注释:nodeName 所包含的 XML 元素的标签名称永远是大写的
nodeValue
对于文本节点,nodeValue 属性包含文本。
对于属 ......
原文地址:http://blog.zenw.org/index/view/id/8
就在刚才,使用GOOGLE查看明天的天气,看到了GOOGLE为纪念《吃豆超人》30周年而更新的《吃豆超人》JavaScript LOGO游戏。很有意思。而且还支持双打(原来的“手气不错”按钮被设置为了双打启动按钮“Insert Coin”)。来试试吧。
如下图
刚刚进入后 ......