Forum Moderators: open

Message Too Old, No Replies

Mozilla queryCommandValue

Getting Mozilla's queryCommandValue to work?

         

geofflee

10:54 am on Mar 5, 2007 (gmt 0)

10+ Year Member



Has anybody been able to get Mozilla's queryCommandValue to work? All it gives me is an empty string each time.


<html>
<head>
<script type="text/javascript">
function selectionFunc() {
var iframe = document.getElementById("if");
alert(iframe.contentWindow.document.queryCommandValue("fontsize"));
}
window.onload = function() {
var iframe = document.getElementById("if");
iframe.contentWindow.document.designMode = "on"
if (document.addEventListener) {
iframe.contentWindow.document.addEventListener('mouseup', selectionFunc, false);
} else if (document.attachEvent) {
iframe.contentWindow.document.onmouseup = selectionFunc;
}
};
</script>
</head>
<body>
<iframe id="if"></iframe>
</body>
</html>

geofflee

1:11 am on Mar 12, 2007 (gmt 0)

10+ Year Member



So it turns out that depending on the implementation (Firefox vs IE vs Opera), queryCommandValue may return an empty string for default command values.