小编Adi*_*chi的帖子

将javascript计算样式从一个元素设置为另一个元素

所以我试图复制适用于一个元素的所有样式(class/id/tagName/attribute等).到目前为止,我发现我可以复制元素的计算样式,只有一个问题... couldend将它应用于其他元素; /

或diffrend复制所有样式的方法.

(这是我得到的:/) http://jsfiddle.net/8KdJd/2/

   //queriks mode + minor changes to retrive the computed style
function getCS(el)
{
    if (el.currentStyle)
        var y = el.currentStyle;
    else if (window.getComputedStyle)
        var y = document.defaultView.getComputedStyle(el,null);
    return y;
}
function setCS(el,cs)
{
    if (el.currentStyle)
    {

        el.currentStyle = cs;
        el.style = cs;
    }
    else if (window.getComputedStyle)
    {el.style = cs 
    }

}


var myLink = document.getElementById('myLink');
var anotherLink = document.getElementById('anotherLink');

var CS_myLink = getCS(myLink);
setCS(anotherLink,CS_myLink);
Run Code Online (Sandbox Code Playgroud)

javascript clone copy set computed-style

11
推荐指数
2
解决办法
9541
查看次数

HTML5中的chrome app'webview'替代品

获得消息称Google将放弃对Chrome打包应用程序的支持

更多信息在这里

我打算用导航HTML5转换我的打包应用程序.

该应用程序使用webviews来托管不同的网站,我正在寻找替代HTML5的webview

HTML中的webview是否有任何可靠的替代方案?

html5 webview google-chrome-app

7
推荐指数
1
解决办法
1796
查看次数