开发者

How to change the font size using execCommand

I am having a style for font in my htm file FON开发者_开发技巧T{ font-size:11px; } which will be loaded initially when my htm loads Now I would like to change the font-size using the following command document.execCommand("fontsize", "", "5"); After execution Now the font tag consists of the attribute size = "5" But I could see font-size:11px still in Current styles of IE Developer toolbar. So the font is not changed.

How to change the font size Please help.


This may be late, but I suggest trying document.execCommand('fontsize,false,'5'). In some browsers, not passing false to defaultUI (the second argument) results in the command not running.

What does it return when you run it? execCommand will return true/false based on success or failure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜