Grunty
08-15-2003, 04:04 AM
I have started to write a function to display a random selection from one of several username/password combinations on a webpage, but being a novice at javascript. I have ground to a halt and would be grateful if someone could point me in the right direction.
Here is what I have done so far:
function passwordlaunch(x)
{
var password = new Array();
password [0] = new Array();
password [0] [0] = "username1";
password [0] [1] = "password1";
password [1] = new Array();
password [1] [0] = "usename2";
password [1] [1] = "password2";
password [2] = new Array();
password [2] [0] = "username3";
password [2] [1] = "password3";
//values go up to username17 etc.
var passwordnumber = (math.floor(math.random() * 16);
//next bit opens a 250x100 window in the centre of the screen
window.open(x);
var cleft=(screen.availwidth-250)/2
var ctop=(screen.availheight-100)/2
var win = window.open("","win","toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=no, width=250px; height=100px, left="+cleft+", top="+ctop);
// writes to the new window
win.document.open();
win.document.write(html code & font formatting removed for clarity);
win.document.write(usernameX);
win.document.write(html code & font formatting removed for clarity);
win.document.write(passwordX);
win.document.close();
}
I am not sure what to do next and how to pass the username and passwords to the new window.
I am also unsure of whether I have approached the array definition in the best way.
Any help gratefully received.
Here is what I have done so far:
function passwordlaunch(x)
{
var password = new Array();
password [0] = new Array();
password [0] [0] = "username1";
password [0] [1] = "password1";
password [1] = new Array();
password [1] [0] = "usename2";
password [1] [1] = "password2";
password [2] = new Array();
password [2] [0] = "username3";
password [2] [1] = "password3";
//values go up to username17 etc.
var passwordnumber = (math.floor(math.random() * 16);
//next bit opens a 250x100 window in the centre of the screen
window.open(x);
var cleft=(screen.availwidth-250)/2
var ctop=(screen.availheight-100)/2
var win = window.open("","win","toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=no, width=250px; height=100px, left="+cleft+", top="+ctop);
// writes to the new window
win.document.open();
win.document.write(html code & font formatting removed for clarity);
win.document.write(usernameX);
win.document.write(html code & font formatting removed for clarity);
win.document.write(passwordX);
win.document.close();
}
I am not sure what to do next and how to pass the username and passwords to the new window.
I am also unsure of whether I have approached the array definition in the best way.
Any help gratefully received.