Results 1 to 4 of 4

Thread: Activate button when Return is clicked?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question 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>&nbsp;<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 />&nbsp;<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>

  2. #2
    Lively Member
    Join Date
    Nov 2000
    Posts
    117
    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">
    thank you
    sharon

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    I have a form already. I am using .Net so I'm not happy about running js when the form is submitted

  4. #4
    Lively Member
    Join Date
    Nov 2000
    Posts
    117

    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?
    thank you
    sharon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width