原生js:js获得当前选中的内容的字体大小

利用currentStyle()和ComputedStyle()

function getstyle(obj, key) {
    if (obj.currentStyle) {
        return obj.currentStyle[key];
    } else {
        return getComputedStyle(obj, false)[key];
    }
}
封装进getstyle
posted @ 2017-06-09 20:06  永醉雨辰  阅读(3128)  评论(0编辑  收藏  举报