Click to See Complete Forum and Search --> : Window sizing and document.write


Grunty
07-29-2003, 07:25 AM
I have a dynamic menu on our intranet, filled with links to many websites.

Some of those websites require passwords and what I have done so far is to add a small piece of code that:

a) opens the target site,

and

b) opens another window with the username and password written in so the user doesn't have to refer to a printed list of passwords.

The link is called from within a script and reads:

javascript:launch ('http://www.externalsite.com','password.htm')

the launch function reads:

function launch(x,y){
window.open(x);
window.open(y);
}

What I would like to do is have the password window open as small as reasonably possible and positioned out of the way somewhere,

and


somehow use document.write to write the username and password to window(y) so that instead of creating many password.htm documents, I could just create one blank one and use it for all of them. It would also simplify administration as I would only have to edit the script when a password changes.

Thanks

Khalid Ali
07-29-2003, 08:52 AM
you can use

var win = window.open("","win","width:200,height=200');

//now you can write to this window

win.document.open();
win.document.write("whatever you want to write");
win.document.close();

//now position the new window at top left corner

win.moveTo(0,0);

Hope this helps

Grunty
07-29-2003, 10:26 AM
Many Thanks for that.

It worked a treat and was short enough for me to understand, so that I have managed to make some changes that open the password window in the centre of the screen.

Ta

Khalid Ali
07-29-2003, 10:34 AM
You are welcome:p