I have another question for which I will give you some more background
info. I am using a external JS script that is called from a source
file on my website. This is the code:
function Login() {
var username=document.login.username.value.toLowerCase ();
var password=document.login.password.value.toLowerCase ();
for (i=0; i<userData.length; i++) {
if (username==userData[i] [0] && password==userData[i] [1]){
window.open(userData[i]
[2],"blank","toolbar=no,width=540,height=250,top=0,le ft=0");
return true;
}
}
alert("Invalid Login!");
}
I would like the window in the above function to open on "top" of the
login page of my website. When I use the input type=button it works
like I want but I HAVE to click on the Login! button which I am trying
to avoid. When I change to input type=submit, the new window opens up
briefly and then "hides" behind the page that holds the form. How do I
fix this or is it even possible? Thanks for taking the time to help.
zero0x wrote:
Anthony napísal(a):
I have a form on a web page that requires to click on a button to
submit the information. I have two questions about changing this form:
1. Is there a way that I can change the script so that the form can be
submitted by hitting the enter key?
2. Is there a way that I can have the Username and Password boxes
cleard after the form is submitted?
You probably don't need the code for the form as it is pretty basic but
here it is just in case. Thanks.
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Bombers Only
Area!</b></font></center></td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=password name=password
size="20"></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!"
onClick="Login()"></td></tr>
</table>
</form>
the easiest way is to add onsubmit="Login(); return false;"
to erase values from form, just add inputobj.value="" to Login()
function.