EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

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
address
area
article
aside
b
base
bdo
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
custom
dd
del
dfn
div
dl
dt
em
embed
fieldSet
figcaption
figure
footer
form
frame
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
kbd
label
legend
li
link
map
mark
menu
nav
object
ol
option
p
pre
q
rt
ruby
s
samp
script
section
select
small
span
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
u
ul
var

 

 

Mostrar:
© 2014 Microsoft