|
-
Jun 29th, 2004, 02:26 AM
#1
Thread Starter
Frenzied Member
Activate button when Return is clicked?
I have a login. When I have entered username and password and hit return I wish to activate the button "Login" instead of the user needs to click the button. How can I solve that?
Code:
<table bgcolor="#efefef">
<tr>
<td colspan=2 class=overtext align=center>Login</td>
</tr>
<tr>
<td><asp:label ID=lblBruger Runat=server>Indtast Brugernavn</asp:label></td>
<td><asp:textbox id="txtBruger" cssclass=tastfelt runat="server" Width=80px></asp:textbox> <FONT SIZE="2" COLOR="red">*</FONT>
<asp:RequiredFieldValidator ControlToValidate="txtBruger" Display=dynamic runat="server" id="RequiredFieldValidator1" /></td>
</tr>
<tr>
<td><asp:Label ID=lblPassw Runat=server>Indtast Password</asp:Label></td>
<td><asp:textbox TextMode="Password" cssclass=tastfelt id="txtPwd" runat="server" Width=80px /> <FONT SIZE="2" COLOR="red">*</FONT>
<asp:RequiredFieldValidator ControlToValidate="txtPwd" Display=dynamic runat="server" id="RequiredFieldValidator2" />
</td>
</tr>
<tr>
<td colspan=2 align=center>
<asp:button cssclass="knap2" id="btnLogin" Text="Login" OnClick="Login_Click" runat="Server" /><br>
<asp:Label id="lblLoginMsg" runat="server" style="COLOR: red"></asp:Label>
</td>
</tr>
</table>
-
Jun 29th, 2004, 05:51 AM
#2
Lively Member
first ' i think you have to put a form in the code
then use an img insted of button
example:
function CutYechida(form)
{
if (!isAlpha(form.shemel_maon.value) && form.shemel_maon.value!="") {
this.document.updateform.submit();
return
}
alert("has to be a number");
this.document.location.reload(true);
}
//-->
this is the function in javascript that i call with
my form name is updateform
<img id="Send2" onclick="CutYechida(document.updateform);" height="20" src="But_cnisa_n.gif" width="78" border="0" name="Send2">
-
Jun 29th, 2004, 06:00 AM
#3
Thread Starter
Frenzied Member
I have a form already. I am using .Net so I'm not happy about running js when the form is submitted
-
Jun 29th, 2004, 06:26 AM
#4
Lively Member
replay
<SCRIPT language=vbscript>
<!--
Option Explicit
Function ManuyForm_onsubmit
dim myForm
set myForm = document.ManuyForm
if len(myForm.shemel_maon.value) > 0 and not IsNumeric(myForm.shemel_maon.value) Then
MsgBox "cccccccccc", _
48, _
"cccccccc"
myForm.shemel_maon.focus()
myForm.shemel_maon.select()
ManuyForm_onsubmit = false
exit function
ManuyForm is my form name
mybe that will help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|