function getWindowsUserName()
{
var WinNetwork = new ActiveXObject("WScript.Network");
var urlToSite = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + WinNetwork.UserName;
window.frames["psyncLink"].src = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + WinNetwork.UserName;
return;
}
我正在尝试使框架加载 urlToSite
<body onload="getWindowsUserName()">
<frameset cols="300px, *">
<frame src="topo1.htm" name="topo" id="topo" application="yes" />
<frame src="topo1.htm" name="psyncLink" id="psyncLink" application="yes" />
</frameset>
</body>
其实现在我只是得到一个空白页。如果我在 IE 中访问同一个站点并手动输入用户名(不区分大小写),则页面会在 IE 中加载。因此我认为这是代码中的问题
<html>
<head>
<title>AIDS (Automated ID System)</title>
<HTA:APPLICATION
id="frames"
border="thin"
caption="yes"
icon="http://www.google.com/favicon.ico"
showintaskbar="yes"
singleinstance="yes"
sysmenu="yes"
navigable="yes"
contextmenu="no"
innerborder="no"
scroll="auto"
scrollflat="yes"
selection="yes"
windowstate="normal" />
<script language="javascript" type="text/javascript">
function getWindowsUserName()
{
var WinNetwork = new ActiveXObject("WScript.Network");
var urlToSite = createCustomURL(WinNetwork.UserName);
document.getElementById("psyncLink").src = urlToSite;
}
function createCustomURL(userName)
{
var customURL = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + userName;
return customURL;
}
</script>
</head>
<body onload="getWindowsUserName()">
<frameset cols="300px, *">
<frame src="topo1.htm" name="topo" id="topo" application="yes" />
<frame src="topo1.htm" name="psyncLink" id="psyncLink" application="yes" />
</frameset>
</body>
</html>