From: http://www.iteye.com/topic/166395
备忘一下:)
<script type="text/javascript">
var mydiv=document.getElementById("test")
function getCurrentStyle(obj, cssproperty, csspropertyNS){
if(obj.style[cssproperty]){
return obj.style[cssproperty];
}
if (obj.currentStyle) {// IE5+
return obj.currentStyle[cssproperty];
}else if (document.defaultView.getComputedStyle(obj, null)) {// FF/Mozilla
var currentStyle = document.defaultView.getComputedStyle(obj, null);
var value = currentStyle.getPropertyValue(csspropertyNS);
if(!value){//try this method
value = currentStyle[cssproperty];
}
return value;
}else if (window.getComputedStyle) {// NS6+
var currentStyle = window.getComputedStyle(obj, "");
return currentStyle.getPropertyValue(csspropertyNS);
}
}
alert(getCurrentStyle(mydiv, "backgroundColor", "background-color")); //alerts "yellow"
</script>
分享到:
相关推荐
例如,`display`和`visibility`放在一起,`list-style`的三个子属性`list-style-type`、`list-style-position`和`list-style-image`依次排列,然后是定位属性`position`、`top`、`right`、`bottom`、`left`和`z-...
在jQuery中,我们可以通过CSS3的transform属性结合jQuery的动画功能来实现这一效果。 1. **HTML结构**: 在HTML中,我们需要为每张图片创建一个元素,通常使用`<div>`或者`<img>`标签,并为它们设置相应的类名以...
$page1.removeClass("current").attr("style",""); }); // ... 类似的代码为其他页面元素调用resize函数 } }); ``` 在这个例子中,当用户与元素交互时(例如点击),`increase`函数会被调用,将元素放大至400...
这通常通过调整`z-index`属性来实现,更高的`z-index`值表示元素更靠前。 至于“图片自动切换位”,我们可以使用jQuery的定时器`setInterval`,按照预设的时间间隔自动切换图片。这通常结合`fadeOut`和`fadeIn`动画...
CSS用于美化网页,设置图片的初始位置、大小、边距等属性。在滚动图中,可以使用绝对定位和z-index来控制图片的层次关系,确保正确显示和隐藏图片。例如: ```css #scrollingGallery { position: relative; } #...
HttpContext.Current.Response.Write("targetElem.style.visibility = 'hidden';"); HttpContext.Current.Response.Write("}"); // 结束script标签 HttpContext.Current.Response.Write("</script>"); } ``` ...
- **过渡效果**: 利用 CSS 的 `transition` 属性实现图片的平滑过渡。 #### 三、代码详解 1. **HTML结构** ```html <!-- 多张图片 --> ‹ › <!-- 小圆点 --> ``` 2. **CSS样式** ```css #...
这通常涉及`position`, `z-index`, `transition`等属性: ```css #carousel { position: relative; width: 100%; } #carousel img { position: absolute; width: 100%; opacity: 0; transition: opacity 0.5...
- `此标签为整个推荐模块的容器,包含了一些CSS样式属性以及JavaScript配置数据,如`'effect':'fade'`表示轮播效果为渐变切换。 - `用于存放多个商品项的列表容器。 - `<li style="DISPLAY:block;Z-INDEX:1;opacity:...
例如,使用`position`属性将轮播图中的各个元素进行定位,同时确保轮播图整体在页面中的居中显示。 ```css #carousel-box { position: relative; width: 700px; height: 300px; background-color: pink; ...
-Button控件将不再自动拥有display:inline属性,如果希望两个按钮在一行显示,请为第一个按钮设置CssStyle="float:left;"属性。 -修正了弹出菜单的位置在Firefox下不正确的BUG(feedback:eroach)。 -为TriggerBox...
-Button控件将不再自动拥有display:inline属性,如果希望两个按钮在一行显示,请为第一个按钮设置CssStyle="float:left;"属性。 -修正了弹出菜单的位置在Firefox下不正确的BUG(feedback:eroach)。 -为TriggerBox...
2. **滚动条隐藏**:通过CSS样式将滚动条隐藏,使用户界面更加整洁。 3. **动态控制**:使用JavaScript定时调整滚动条的位置,当滚动条到达底部时,将其瞬间调整回顶部,从而达到视觉上的连续滚动效果。 #### 实现...
- **CSS背景图片设置**:避免使用`<img>`标签,改用CSS的`background`属性设置图片,减少页面的DOM节点,提高渲染性能。 - **绝对定位**:使用绝对定位来放置每个焦点图面板,并通过JavaScript动态控制面板的可见性...
在ASP.NET Web Forms中,为了使表格能够自适应不同的浏览器窗口大小,可以通过设置CSS样式中的`table-layout`属性来实现。 **示例代码:** ```html <table style="table-layout: fixed;"> <td style="word-wrap:...
这可以通过绝对定位和z-index属性来实现: ```css #focusGallery { position: relative; } #focusGallery img { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 0.5s ease-in-out; }...
<div id="emoticon-layer" style="display:none;"> <!-- 更多表情... --> ``` 2. **CSS 样式**:定义层的样式,包括位置、大小、透明度等,确保它在需要时可以正确显示。同时,也要设定表情元素的样式。 `...
在`<style>`标签内部,定义了图片切换效果所需的CSS样式。这些样式包括`.all`类设置父容器的尺寸、定位和溢出隐藏;`.allul`、`.allulli`和`.allol`分别设置`ul`列表、`li`元素和`ol`列表的布局和定位;`.allolli`和...
首先,我们需要了解的关键技术是CSS的`transform`属性,尤其是`translate3d`和`perspective`。`translate3d`用于在三维空间中移动元素,它可以改变元素的位置,使其产生堆叠效果。`perspective`属性则定义了观察者与...
list-style: none; } #header li { float: left; background: url("left.gif") no-repeat left top; margin: 0; padding: 0 0 0 9px; } #header a { float: left; display: block; background: url("right...