Well, the fields should be receiving text after 2 seconds (2000) and they do when I tested it.
This is the html I had for the login page:
HTML Code:
<input type="Text" id="txtClientID" />
<input type="Text" id="txtUserID" />
<input type="Text" id="txtPassword" />
document.getElementById() will only work if those textboxes HAVE an id (Which is what your first post implied). If, however, they don't have ids, you can refer to them by name (provided that they are inside a named <form>).
HTML Code:
<form name="loginform" action="etc. etc." method="GET">
<input type="Text" name="Client" />
<input type="Text" name="User" />
<input type="Text" name="Password" />
</form>
Code:
function fillLogin()
{
var loadDelay = 2000;
opening = window.open("theloginpage.html");
setTimeout("opening.document.loginform.Client.value='xxxx';",loadDelay);
setTimeout("opening.document.loginform.User.value='xxxx';",loadDelay);
setTimeout("opening.document.loginform.Password.value='xxxx';",loadDelay);
}
ps. Remember to enable scripts for file:// if you have NoScript on ._. otherwise, it will never work lol
----------
I took this a step further and decided to make an auto-login USB stick which could fill out my username and password on multiple sites once I plug it in. All these files can be made in notepad (just make sure to save them as the right extensions). Just create them and put them on the drive.
autologin.html
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="fillLogin.js"></script>
</head>
<body onload="fillLogin()">
</body>
</html>
fillLogin.js
Code:
var webList = new Array();
var username = new Array();
var userBox = new Array();
var password = new Array();
var passBox = new Array();
var loadDelay = 3000;
// Add your sites here:
// (Example)
webList[0]="test.html"; // Website Address:
username[0]="my name"; // Username:
userBox[0]="user"; // Id for Username textbox
password[0]="secret"; // Password:
passBox[0]="pass"; // Id for Password textbox
//webList[1]="http://mail.google.com/";
//username[1]="[email protected]";
//userBox[1]="Email";
//password[1]="the_password";
//passBox[1]="Passwd";
// ==== DO NOT EDIT BELOW ===
function fillLogin()
{
for (i=0;i<username.length;i++)
{
opener = window.open(webList[i]);
setTimeout("opener.document.getElementById('" + userBox[i] + "').value='"
+ username[i] + "';", loadDelay);
setTimeout("opener.document.getElementById('" + passBox[i] + "').value='"
+ password[i] + "';", loadDelay);
}
}
// === end ===
Autorun.inf
Code:
[autorun]
Open = firefox.exe "autologin.html"
shell\open\command=firefox.exe "autologin.html"
useautoplay=1
And finally, the test file
test.html
HTML Code:
<input type="Text" id="user" />
<input type="Password" id="pass" />
edit: Hmm.. curiously, this doesn't seem to work when the source and destination are not on the same server. Maybe for security reasons..
Oh well, my idea of multiple site login was kind of useless if this is the case XD
Perhaps that's why it doesn't work for you?
edit2: Potentially, you could trick the browser into thinking the source and destination are the same by using a PHP include. I don't really have time to work on this now. I'll see what I can come up with later.