How to only copy an element's styles to another element?
<p>I have tried "window.getComputedStyle" and "currentStyle",but it not work except the chrome.
Please look my demo below firstly,thanks.
<a href="http://www.learning.fancyboy.net/javascript/cloneStyles.html" rel="nofollow">http://www.learning.fancyboy.net/javascript/cloneStyles.html</a>
The code is:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8" /&gt;
        &lt;title&gt;clone style&lt;/title&gt;
        &lt;style&gt;
            *{margin:0;padding:0;}
            #text1{width:200px;height:50px;border:1px solid red;color:#ccc;line-height:50px;padding:5px;margin:5px;}
        &lt;/style&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;div&gt;
            &lt;input type="text" id="text1" value="origin" /&gt;
            &lt;input type="text" id="text2" value="clone" /&gt;
        &lt;/div&gt;
        &lt;script&gt;
            var
            text1=document.getElementById("text1"),
            text2=document.getElementById("text2"),
            cssObj,
            sCssText="";
            if(!!window.getComputedStyle){
                cssObj=window.getComputedStyle(text1,null);
                sCssText=cssObj.cssText;
            }
            else{
                cssObj=text1.currentStyle;
                for(var k in cssObj){
                    sCssText+=k+":"+cssObj[k]+";";
                }
            }   
            text2.style.cssText=sCssText;
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Any idea?</p>
