HBCMS更多的中文手册参考:

controlRange Collection

DHTML文档教程

A collection of elements returned by the createcontrolrange or createrange method.

members table

PropertyDescription
length Sets or retrieves the number of objects in a collection.
MethodDescription
add Adds an element to the areas, controlrange, or options collection.
addElement Adds an element to the controlRange collection.
execCommand Executes a command on the current document, current selection, or the given range.
item Retrieves an object from the controlRange collection.
queryCommandEnabled Returns a Boolean value that indicates whether a specified command can be successfully executed using execcommand, given the current state of the document.
queryCommandIndeterm Returns a Boolean value that indicates whether the specified command is in the indeterminate state.
queryCommandState Returns a Boolean value that indicates the current state of the command.
queryCommandSupported Returns a Boolean value that indicates whether the current command is supported on the current range.
queryCommandValue Returns the current value of the document, range, or current selection for the given command.
remove Removes an element from the collection.
scrollIntoView Causes the object to scroll into view, aligning it either at the top or bottom of the window.
select Makes the selection equal to the current object.

Remarks

Instead of using the collection's item method, you can use an index to directly access an element in the collection. for example, the element returned from the collection represented by ocoll(0) is the same as the element returned by ocoll.item(0).

the controlrange collection is available as of microsoft® internet explorer 5.

DHTML代码范例

This example demonstrates how to use the createrange method to retrieve the controlrange collection.

...
function fnChangeFontFamily    (){
if (document.selection.type == "Control"){
var oControlRange = document.selection.createRange();
for (i = 0; i < oControlRange.length; i++)
if (oControlRange(i).tagName != "IMG")
oControlRange(i).style.fontFamily=event.srcElement.style.fontFamily;
}
}
...
<!-- Text Font-Family Controls  -->
<SPAN  onclick="fnChangeFontFamily();">
<DIV STYLE="height: 25px; cursor:hand; font-family:times;
font-size:14pt; font-weight:normal; color:white">Times</DIV>
<DIV STYLE="height: 25px; cursor:hand; font-family:arial;
font-size:14pt; font-weight:normal; color:white">Arial</DIV>
<DIV STYLE="height: 25px; cursor:hand; font-family:georgia;
font-size:14pt; font-weight:normal; color:white">Georgia</DIV>
<DIV STYLE="height: 25px; cursor:hand; font-family:verdana;
font-size:14pt; font-weight:normal; color:white">Verdana</DIV>
</SPAN><BR/>
...
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

There is no public standard that applies to this collection.

更多语法参考

createcontrolrange, createRange