Share this page 

Use a JAVASCRIPT username/password instead the browser's oneTag(s): Varia

URL can be constructed with a special syntax to include an username and password. The format is The URL is protected using the mechanism included with the web server.
 var targetUrl="";
 function login() {
    if (validLogin()) {
       password = document.userInfos.username.value;
       username = document.userInfos.password.value;
 function validLogin() {
    if (isBlank(document.userInfos.username.value)){
       alert("Can't be blank");
       return false;
    if (isBlank(document.userInfos.password.value)){
       alert("Can't be blank");
       return false;
    return true;      
 function isBlank(s) {
    return (s == "");

 <BODY onLoad="document.userInfos.username.focus();">
 <H1><CENTER>Identification </H1></CENTER>
 <FORM  NAME=userInfos>
 <TR><TD>User: </TD><TD>
 <INPUT TYPE="text" NAME=username LENGTH=20></TD></TR>
 <TR><TD>Password: </TD><TD> 
 <INPUT TYPE="password" NAME=password LENGTH=20>
 <TR ALIGN=center>
 <INPUT TYPE="button" VALUE="Ok" onClick="login()">