<html>
<head>
<title>Tabs.hta</title>
<HTA:Application
ID = "HTA"
ApplicationName = "Tabs"
Border = "thin"
BorderStyle = "normal"
Caption = "yes"
ContextMenu="yes"
Icon = ""
InnerBorder="no"
MaximizeButton = "yes"
MinimizeButton = "yes"
Navigable="yes"
Scroll="yes"
SrollFlat="no"
Selection="yes"
ShowInTaskBar = "yes"
SingleInstance = "yes"
SysMenu = "yes"
Version = "1.0"
>
<script language="VBscript">
Dim sItem
Dim aPanels
Dim el
Dim iPanelCount
Dim sConfigFile
Dim objINI
Private Sub Window_OnLoad
Set objINI = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
sConfigFile = "Config.ini"
Set objConfig = objFSO.OpenTextFile(sConfigFile, intForReading, False)
strHeading = ""
While Not objConfig.AtEndOfStream
strLine = objConfig.ReadLine
If strLine <> "" Then
If Left(strLine, 1) = "[" Then
strHeading = Mid(strLine, 2, Len(strLine) - 2)
Else
If objINI.Exists(strHeading) = True Then
objINI(strHeading) = objINI(strHeading) & "|" & strLine
Else
objINI.Add strHeading, strLine
End If
End If
End If
Wend
iPanelCount = objINI.Count
objConfig.Close
strHTMLCode = ""
i = 0
For Each strHeading In objINI
i = i + 1
If i = 1 Then
strHTMLCode = "<span class=""tabs tabsSelected"" id=""tab" & i & """ onclick=""panel(" & i & ")"">" & strHeading & "</span>"
Else
strHTMLCode = strHTMLCode & "<span class=""tabs tabsNotSelected"" id=""tab" & i & """ onclick=""panel(" & i & ")"">" & strHeading & "</span>"
End If
Next
i = 0
For Each strHeading In objINI
i = i + 1
If i = 1 Then
strHTMLCode = strHTMLCode & "<div class=""panel"" id=""panel" & i & """ style=""display:block"">"
Else
strHTMLCode = strHTMLCode & "<div class=""panel"" id=""panel" & i & """ style=""display:none"">"
End If
strHTMLCode = strHTMLCode & "<hr color=""black"">"
strHTMLCode = strHTMLCode & "<table border=""0"" width=""100%"">"
strHTMLCode = strHTMLCode & "<tr valign=""top"">"
strHTMLCode = strHTMLCode & "<td>"
strHTMLCode = strHTMLCode & "<span id=""panelContents" & i & """ class=""head"">"
For Each strItem In Split(objINI(strHeading), "|")
strHTMLCode = strHTMLCode & "<br><input type=""checkbox"" id=""chk_" & Replace(strItem, " ", "_") & """ name=""chk_" & Replace(strItem, " ", "_") & """>" & strItem
Next
strHTMLCode = strHTMLCode & "</span>"
strHTMLCode = strHTMLCode & "<br><br>"
strHTMLCode = strHTMLCode & "TAB " & i & ""
strHTMLCode = strHTMLCode & "</td>"
strHTMLCode = strHTMLCode & "</tr>"
strHTMLCode = strHTMLCode & "</table>"
strHTMLCode = strHTMLCode & "</div>"
Next
span_tabspan.InnerHTML = strHTMLCode
End Sub
Private Sub Panel(tab)
For i = 1 To iPanelCount
If i = tab Then
document.getElementById("tab" & i).className = "tabs tabsSelected"
document.getElementById("panel" & i).style.display = "block"
Else
document.getElementById("tab" & i).className = "tabs tabsNotSelected"
document.getElementById("panel" & i).style.display = "none"
End If
Next
End Sub
Sub AddCheck
strHTML = panelContents2.InnerHTML
strHTML = strHTML & "<input id=" & intCheckCount & " type=" & Chr(34) & "CheckBox" & Chr(34) & _
" name=" & Chr(34) & "chkEnabled" & Chr(34) & "value= " & Chr(34) & "CheckBox" & intCheckCount & Chr(34) & " onClick=" & Chr(34) & _
"NewCheckSubroutine" & Chr(34) & ">" & " <BR>"
panelContents2.InnerHTML = strHTML
End Sub
</script>
<style type="text/css">
body,td,th { font-family:Arial }
.head { font-size:110%; font-weight:bold }
.panel {
background-color: white;
border: solid 1px black;
height: 410px;
padding: 5px;
position: relative;
width: 650px;
z-index: 0;
}
.tabs {
border-collapse: collapse;
color: black;
cursor: pointer;
cursor: hand;
font-family: arial;
font-size: 9pt;
font-weight: bold;
margin-top: 4px;
padding: 2px 4px 0px 4px;
position: relative;
text-align: center;
text-decoration: none;
z-index: 1;
}
.tabsNotSelected {
background-color: wheat;
border: solid 1px black;
}
.tabsSelected {
background-color: white;
border-color: black black white black;
border-style: solid solid solid solid;
border-width: 1px 1px 1px 1px;
}
</style>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="650">
<tr valign="top">
<td align="right" colspan="2">
<span class="head">Tabs in HTA!</span>
<br>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<span id="span_tabspan"></span>
</td>
</tr>
</table>
</body>
</html>
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE