如何在HTA页面上显示userinfo

问题描述

因此,我开始编写VBScript以将来自不同位置的AD用户信息放入一个msgBox中,然后发现HTA现在试图在HTA中显示,但我不知道该怎么做。我正在使用document.getElementById,我认为可以显示多少个字符存在一些限制。

<!DOCTYPE HTML>
<html>
<head>
<title>My First HTML Application</title>
 
<HTA:APPLICATION
  APPLICATIONNAME="My First HTML Application"
  ID="MyFirstHTA"
  VERSION="1.0"
  SCROLL="yes"/>
 
<style type="text/css">
body {
    background-color: #fdfeff;
    color: darkblue;
    font-family: Calibri;
    font-size: 12pt;
    margin: 4em 3em;
}
</style>
</head>
 
<script language="VBScript">

Sub CheckName()
On Error Resume Next
Dim objSysInfo,objUser
Set objSysInfo = CreateObject("ADSystemInfo")
strFalse.font.color = RGB(255,0)
strFalse = "disabled"

struserName = document.getElementByID( "InputName" ).value
Aryusername = Split(struserName," ")
Set objUser = Getobject("LDAP://CN=" & Aryusername(0) & "." & Aryusername(1) & ",OU=Users,OU=XXXX,DC=xxxxxx,DC=com")
if (objUser.Accountdisabled = False) Then
    strResult = strFalse
    strResult.font.color=RGB(255,0)
else 
    strResult = strTrue
    strResult.font.color=RGB(0,255,0)
end if

strText = "GENERAL" & "<BR><BR>" & _
    "Full Name: " & objUser.givenname & " " & objUser.initials & " " & objUser.sn & "<BR>" & _
    "display Name: " & objUser.displayName & "<BR>" & objUser.description & "<BR>" & _
    "Email: " & objUser.mail & "<BR><BR>" & "ACCOUNT" & "<BR><BR>"

document.getElementById( "OutputResult1" ).innerHTML = strText

'document.getElementById( "OutputResult1" ).innerHTML = "GENERAL" & "<BR><BR>" & _
'   "Full Name: " & objUser.givenname & " " & objUser.initials & " " & objUser.sn & "<BR>" & _
'   "display Name: " & objUser.displayName & "<BR>" & objUser.description & "<BR>" & _
'   "Email: " & objUser.mail & "<BR><BR>" & "ACCOUNT" & "<BR><BR>" & _
'   "User logon Name: " & objUser.PrincipalName & "<BR>" & "Is Account: " & strResult & "<BR>" & _

'document.getElementById( "OutputResult2" ).innerHTML = "ACCOUNT" & "<BR><BR>" & _
'   "User logon Name: " & objUser.PrincipalName & "<BR>" & "Is Account: " & strResult & "<BR>" & _
'   "AD created on: " & objuser.whenCreated 

End Sub


Sub Window_OnLoad
    window.resizeto 640,480
    document.title = document.title & ",Version " & MyFirstHTA.Version
End Sub
</script>
 
<body>
 
<p><input type="text" id="InputName"/>
&nbsp;
<input type="button" value="Submit" onclick="CheckName" /></p>
 
<p>&nbsp;</p>
 
<p id="OutputResult1">Enter a name of person to check.</p>

<p id="OutputResult2">and click on the Submit button</p>
 
</body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)