hey all...i have no idea why i can't get the logic down with this...
i have an hta...in which cannot use sleep so ended up choosing window.setInterval
the problem: i have successfully displayed the loader however...my logic was off...i was displaying the loader delay>loop>display loop results
i would have said screw it...however...with large returns...this is not feasible...so...
how do i simply show a loader(animated.gif) WHILE the loop is collecting data? ...it's rather embarrassing to say...but i simply cannot get it to work
thanks
i have an hta...in which cannot use sleep so ended up choosing window.setInterval
the problem: i have successfully displayed the loader however...my logic was off...i was displaying the loader delay>loop>display loop results
i would have said screw it...however...with large returns...this is not feasible...so...
how do i simply show a loader(animated.gif) WHILE the loop is collecting data? ...it's rather embarrassing to say...but i simply cannot get it to work
thanks
Code:
<html>
<head>
<title>Student Account</title>
<style>
div.results {width:100%;height:300px;overflow-y:scroll;}
table {border:1px solid black;width:75%;}
th {width:33%;background:#eee;padding-left:75px;}
table.results {border:none;width:100%;}
td {text-align:center;}
img.loader {position:relative;left:50px;top:25px;}
</style>
<hta:application
windowState="normal">
<script language="VBScript">
Dim oConn, iTimerID
Sub DisplayStudentAccts(sUserInput)
If Len(sUserInput) > 0 Then
Set oRootDSE = GetObject("LDAP://RootDSE")
sConfig = oRootDSE.Get("configurationNamingContext")
sDomainAdsPAth = oRootDSE.Get("defaultNamingContext")
sAdsPath = "OU=Student Users," & sDomainAdsPAth
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADsDSOObject"
oConn.Open "Active Directory Provider"
on error resume next
Set oRs = oConn.Execute("SELECT cn, adspath " & _
"FROM 'LDAP://" & sAdsPath & "'" & _
"WHERE cn='" & sUserInput & "*'")
If Not oRs.EOF Then
sRowColor = "white"
iTimerID = window.setInterval("DisplayLoader", 500,"vbscript")
Do While Not oRs.EOF
iCount = iCount + 1
iStuAcctTot = oRs.Recordcount
sAdsPath = oRs("ADsPath")
Set oStudentAcct = GetObject(sAdsPath)
dPwdLastChanged = oStudentAcct.PasswordLastChanged
If iCount < iStuAcctTot Then
DisplayLoader
If Len(dPwdLastChanged) = 0 Then dPwdLastChanged = "Password never set"
sResults = sResults & "<tr bgcolor=""" & sRowColor & """>" & _
" <td>" & iCount & "</td>" & _
" <td>" & oRs("cn") & "</td>" & _
" <td>" & dPwdLastChanged & "</td>" & _
" <td><input type=""checkbox"" name=""stuacctck"" value=""" & oRs("cn") & """>" & _
"</tr>"
If sRowColor = "white" Then
sRowColor = "#eeeeee"
Else
sRowColor = "white"
End If
Else
window.clearInterval(iTimerID)
End If
oRs.MoveNext
Loop
results.innerhtml = "<table cellspacing=""1"">" & _
" <tr>" & _
" <th>#</th>" & _
" <th>Student Account</th>" & _
" <th>Password Last Changed</th>" & _
" <th><a href=""#"" onclick=""checkAll(stuacctck)"">Select All</th>" & _
" </tr>" & _
" <tr>" & _
" <td colspan=""4"">" & _
" <div class=""results"">" & _
" <table class=""results"">" & _
sResults & _
" </table>" & _
" </div>" & _
" </td>" & _
" </tr>" & _
"</table>"
Else
results.innerhtml = "<img src=""[URL unfurl="true"]http://webs.wichita.edu/depttools/depttoolsmemberfiles/accomp/question_mark%20(WinCE).jpg"">"[/URL]
End If
End If
End Sub
Sub DisplayLoader
results.innerHtml = "<img class=""loader"" src=""[URL unfurl="true"]http://www.dzone.com/images/std/ajax-loader-85.gif"">"[/URL]
End Sub
</script>
</head>
<body>
Student Account: <input id="stuacct">
<input type="button" value="Go" onclick="DisplayStudentAccts(stuacct.value)">
<div id="results"></div>
</body>
</html>