First of all here is the script enabled for an image button. It was driving me nuts but then I figured out that the
onclick works differently if you use an image instead of a button. I had to add a
return false.
Here is the functional code, I have the username boby and password bobby hardcoded in because I was testing but you can fix it up and it should work:
Code:<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Login(form) {
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + server + username + "/";
window.location = htsite;
}
else {
alert("Please enter your username and password.");
}
}
// End -->
</script>
</head>
<body>
<form name=login>
<input type="hidden" name="server" value="www.mrbobdouglas.com/">
Username:
<input type=text name=username size=20 value="bobby">
<br><br>
Password:
<input type=password name=password size=20 value="bobby">
<input type=image src="submitimage.gif" onClick="Login(this.form); return false;">
</form>
</body>
</html>
Now as to your lastest question I do not think it is possible to do with javascript.