function getWindowsUserName()
{
var WinNetwork = new ActiveXObject("WScript.Network");
var urlToSite = createCustomURL(WinNetwork.UserName);
document.getElementById("psyncLink").src = urlToSite;
if(requestingPassword())
{
alert("password button screen");
} else {
alert("direct password required");
}
}
function requestingPassword()
{ // <-- This is the line that is getting the error
// Unspecified error
// Code: 80004005
// Microsoft JScript Runtime error
var btn = window.frames[1].document.getElementsByName("SUBMIT-password.pss");
if (btn.length == 0) {
return false;
} else {
return true;
}
}
I wanted requestingPassword to be a bool method but then i learned that Javascript doesn;t support method names like
public bool nameofmethod()
I think the syntax is correct. Any help would be appreciated!
requestingPassword()is called immediately after setting the URL of a frame. It’s extremely likely that the page did not finish loading when theframes[1].document.....method was called. In that case,frames[1].documentisnull, which causes an error to be thrown.To fix this problem, simply call the
requestingPasswordfunction in anonloadevent.window.frames[1](which is not easy to maintain), useframe.contentWindow(which is supported extremely well, and does not depend on knowledge of the frame’s position)onloadas a property will not bind an event in IE6-. If you have to support IE6, use.attachEvent("onload", func..);.