setActive method

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

Syntax

object.setActive()

Parameters

This method has no parameters.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

There are no standards that apply here.

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

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, although the object does not receive focus. The object receives focus when its page receives focus. To confirm that the object is active, click the right window's title bar. The button appears to be selected.


<html>
<head>
<script type="text/javascript">
  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>


See also

a
abbr
acronym
address
applet
area
article
aside
b
base
baseFont
bdo
bgSound
big
blockQuote
body
br
button
caption
center
cite
code
col
colGroup
comment
custom
dd
del
dfn
dir
div
dl
dt
em
embed
fieldSet
figcaption
figure
font
footer
form
frame
frameSet
head
header
hgroup
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
isIndex
kbd
label
legend
li
link
listing
map
mark
marquee
menu
nav
nextID
noBR
noFrames
noScript
object
ol
option
p
plainText
pre
q
rt
ruby
s
samp
script
section
select
small
span
strike
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
tt
u
ul
var
wbr
xml
xmp

 

 

Show:
© 2014 Microsoft