Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Set focus on a radio button in a HTA

$
0
0

Hi,

I have made the HTA below.

I need to be able to set focus on the radio buttons, but I cannot make it work.

I thought that I could use the RadioOption.Focus (or RadioOption.SetFocus) in the window_onload sub but I will get the message "Object doesn't support this property or method"

--- HTA Begins ---

<head>
<HTA:APPLICATION
     APPLICATIONNAME="App 1"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
     SysMenu="no"
     Caption="no"
>

<script language="VBScript">

 Sub Window_onLoad
  window.resizeTo 400,250
     strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
        For Each objItem in colItems
            intHorizontal = objItem.ScreenWidth
            intVertical = objItem.ScreenHeight
        Next
        intLeft = (intHorizontal - 400) / 2
        intTop = (intVertical - 250) / 2
        window.moveTo intLeft, intTop
        RadioOption.SetFocus
   End Sub
 
 Sub GetResult
        For Each objButton in RadioOption
            If objButton.Checked Then
                Selected = objButton.Value
            End If
   
        Next
   msgbox Selected
    
  Self.Close()
    End Sub
 
</script>

</head>

<body STYLE="color:blue">

<br>
<center>
Select an option<BR><BR>
</center>
<table name="test" Align="Center">
   <tr>
    <td><input type="radio" name="RadioOption" value="Selection 1" checked="checked">Selection 1<BR></td>
   </tr>
  <tr>
    <td><input type="radio" name="RadioOption" value="NonStandard">Selection 2<BR></td>
   </tr>
</table>
<center>
 <BR>
 <BR>
 <input type="button" value="Continue" name="GoOn"  onClick="GetResult">
</Center>
</body>


Thomas Forsmark Soerensen


Viewing all articles
Browse latest Browse all 3527

Trending Articles