type Property Internet Development Index --------------------------------------------------------------------------------Retrieves the type of selection. Syntax[ sType = ] selection.type Possible ValuessType String that receives one of the following values.none No selection/insertion point. text Specifies a text selection. control Specifies a control selection, which enables dimension controls allowing the selected object to be resized. The property is read-only. The property has no default value.ResThe selection object is off the document object. ExampleThis example uses the type property to create an alert that indicates the type of object selected by the user. If the user clicks the mouse pointer on the text "Some text", the alert reads "Text". If the user clicks the mouse pointer on the space to the right of the text, the alert reads "None".<BODY onclick="alert(document.selection.type)"> Some text. Standards InformationThis property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 . Applies To[ Object Name ] Platform Version Win16: Win32: Windows CE: Unix: Mac: Version data is listed when the mouse hovers over a link, or the link has focus. selection Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms.
谢谢 net_lover(孟子E章),我大体知道是什么意思,但是 var oControl; var oSeletion; var sRangeType; function SelectionRange() { return dialogArguments.mEditor.document.selection.createRange(); } function SelectionType() { return dialogArguments.mEditor.document.selection.type; } oSelection = SelectionRange(); sRangeType = SelectionType();
type Property Internet Development Index --------------------------------------------------------------------------------Retrieves the type of selection. Syntax[ sType = ] selection.type
Possible ValuessType String that receives one of the following values.none No selection/insertion point.
text Specifies a text selection.
control Specifies a control selection, which enables dimension controls allowing the selected object to be resized.
The property is read-only. The property has no default value.ResThe selection object is off the document object. ExampleThis example uses the type property to create an alert that indicates the type of object selected by the user. If the user clicks the mouse pointer on the text "Some text", the alert reads "Text". If the user clicks the mouse pointer on the space to the right of the text, the alert reads "None".<BODY onclick="alert(document.selection.type)">
Some text.
Standards InformationThis property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 . Applies To[ Object Name ]
Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
Version data is listed when the mouse hovers over a link, or the link has focus.
selection
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms.
var oControl;
var oSeletion;
var sRangeType;
function SelectionRange()
{
return dialogArguments.mEditor.document.selection.createRange();
} function SelectionType()
{
return dialogArguments.mEditor.document.selection.type;
}
oSelection = SelectionRange();
sRangeType = SelectionType();
if (sRangeType == "Control"){
if (oSelection.item(0).tagName == "TABLE"){
oControl = oSelection.item(0);
}
}else{
oControl = getParentObject(oSelection.parentElement(), "TABLE");
}我还是看不懂这句的if (sRangeType == "Control")是什么意思