JavaScript Reference/Javascript Methods/queryCommandEnabled — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 08:22, 26 мая 2010

"queryCommandEnabled()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var myText = document.selection.createRange();
    if (myText.queryCommandEnabled("Delete") == true) {
      document.execCommand("Delete");
    }
} 
</script>
<p id="myText">Sample text to be selected and deleted.</p>
<input type="button" value="Delete selection" onclick="function1();">
</body>
</html>



"queryCommandEnabled()" is applied to

Names noted with an asterisk (*) are JavaScript properties only.
+----------------+--------------------------------------------------------------+
| Applied_To     |controlRange*                   document                      |
|                |TextRange                                                     |
+----------------+--------------------------------------------------------------+



"queryCommandEnabled()" Syntax, Parameters and Note

Note:
Can the specified command be successfully executed. 
Returns true or false.
    
Syntax:
    
controlRangeName.queryCommandEnabled(param1)
objectName.queryCommandEnabled(param1)
Parameters:
    param1   Required; the name of the command. 
             For a complete list of commands, go to 
             http://msdn.microsoft.ru/workshop/author/dhtml/reference/commandids.asp.