Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从contentEditable div从容器中获取样式_Javascript_Css_Extract_Edit_Contenteditable - Fatal编程技术网

Javascript 从contentEditable div从容器中获取样式

Javascript 从contentEditable div从容器中获取样式,javascript,css,extract,edit,contenteditable,Javascript,Css,Extract,Edit,Contenteditable,我需要将容器的样式设置为内容可编辑。基本上,我需要提取: color: red; font-weight: bold; 由此,在内容可编辑div中: <span style='color: red; font-weight: bold;'> ... </span> 有人知道怎么做吗?提前谢谢 PS:将css作为一个对象也很好 var styleObj = getElementsByTagName("span")[0].style; 你需要什么^^

我需要将容器的样式设置为内容可编辑。基本上,我需要提取:

color: red; font-weight: bold;
由此,在内容可编辑div中:

<span style='color: red; font-weight: bold;'>
    ...
</span>
有人知道怎么做吗?提前谢谢

PS:将css作为一个对象也很好

var styleObj = getElementsByTagName("span")[0].style;
你需要什么^^