Makes the selection equal to the current object.
dhtml语法
object.select()
Return Value
No return value.
Remarks
When applied to a textrange object, the select method causes the current object to be highlighted. the following function uses the findtext method to set the current object to the text in the textrange object. the function assumes an element that contains the text string "text here".
function TextRangeSelect() {
var r = document.body.createTextRange();
r.findText("text here");
r.select();
}
When applied to a controlrange collection, the select method produces a shaded rectangle around the elements in the controlrange. the following function uses the add method to set the current object to an element in the controlrange collection. the function assumes an element with an id of "aaa".
function ControlRangeSelect() {
var r = document.body.createControlRange();
r.add(document.all.aaa);
r.select();
}
This feature might not be available on non-Microsoft® Win32® platforms.
是否符合公共标准
This method is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To