<script type="text/javascript">
(function (bool) {
if (bool) {
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
//getComputedStyle方法参数一是目标对象,参数二是具体属性把注释对换下就知道了。。
//return this.ownerDocument.defaultView.getComputedStyle(this, ":first-line");
return this.ownerDocument.defaultView.getComputedStyle(this, null);
});
}
})(/Firefox/.test(window.navigator.userAgent));
</script>
<style type="text/css">
div {
color:#000000;
}
div:first-line {
color:#0000FF;
}
</style>
<div onclick="alert(this.currentStyle.color)">DIV对象<br />第二行</div>
谁来解释下这个是个啥意思吧 不大懂了
代码源地址
(function (bool) {
if (bool) {
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
//getComputedStyle方法参数一是目标对象,参数二是具体属性把注释对换下就知道了。。
//return this.ownerDocument.defaultView.getComputedStyle(this, ":first-line");
return this.ownerDocument.defaultView.getComputedStyle(this, null);
});
}
})(/Firefox/.test(window.navigator.userAgent));
</script>
<style type="text/css">
div {
color:#000000;
}
div:first-line {
color:#0000FF;
}
</style>
<div onclick="alert(this.currentStyle.color)">DIV对象<br />第二行</div>
谁来解释下这个是个啥意思吧 不大懂了
代码源地址
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货