HBCMS更多的中文手册参考:

setActive Method

DHTML文档教程

Sets the object as active without setting focus to the object.

dhtml语法

object.setActive()

Return Value

No return value.

Remarks

The setActive method does not cause the document to scroll to the active object in the current page or in another frame or window.

Examples

This example demonstrates how to use the setActive method between frames.

...
<SCRIPT>
function fnBottomActive(){
//Set the object with ID=btnLarger active in frame with ID=oFrame1.
window.parent.oFrame1.secondButton.setActive();
}
</SCRIPT>
...
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.

This example demonstrates how to use the setActive method between windows. By clicking the 'SetActive' button in the left window, the method sets the 'Second Button' as the active object in the right window, though the object does not receive focus. The object only receives focus when its page receives focus. To confirm that the object is active, click on the right window's title bar. The button appears to be selected.

<HTML>
<HEAD>
<SCRIPT>
function fnOpen(){
//Open new window.
oWin1 = window.open("/workshop/samples/author/dhtml/refs/setactive_content.htm",
"oWin1",
"top=10px,left=480px,height=375px,width=200px,resizable=1");
//Set focus back to the parent window.
this.focus();
}
function fnBottomActive(){
//Set the object with ID=btnLarger active in the other window.
window.parent.oWin1.secondButton.setActive();
}
</SCRIPT>
</HEAD>
<BODY onload="fnOpen();">
<CENTER>
<TABLE border="1">
<TR><TD>
<BUTTON id="btn1" onclick="fnBottomActive();">Set Active</BUTTON></TD></TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
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 method.

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CUSTOM, DD, DFN, DIR, DIV, DL, document, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, window, XMP