dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Logon

  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Logon

    Can anyone let me know what is wrong with my logon form (ASP.NET/JS), since I would like to submit the form, and, ideally read the user and password from the db?

    So far the hardcoded version does not work either...

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Logon.aspx.cs" Inherits="Logon" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    <style type="text/css">
    #Text1
    {
    width: 146px;
    margin-left: 21px;
    }
    #Password1
    {
    width: 147px;
    }
    .style1
    {
    font-family: Arial, Helvetica, sans-serif;
    }
    #user
    {
    width: 41px;
    margin-left: 96px;
    }
    </style>
    <script language="javascript" type="text/javascript">
    // <![CDATA[

    function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
    }

    function Submit1_onclick() {
    /* Logon credentials to be submitted and verified by the server control */
    var user = document.getElementById('user').Value;
    var pwd = document.getElementById('pwd1').Value;
    if (user = "1") && (pwd = "1")
    {
    return true;
    document.getElementById("Text1").Value="authOK";
    document.forms[0].submit();
    }
    else {
    document.getElementById("Text1").Value="NoAuth";
    }
    }

    function Submit1_onclick() {

    }

    // ]]>
    </script>
    </head>
    <body id="body">
    <form id="form1" runat="server">
    <div>

    <span class="style1">Aristotle library information system</span><br />
    <asp:Image ID="Image1" runat="server" Height="102px"
    ImageUrl="~/img/Aristotle_Bust_White_Background_Transparent.png" Width="88px" />
    <br />
    <br />
    Logon:
    <input id="user" type="text" onclick="return Text1_onclick()" /><br />
    Password:
    <input id="pwd1" type="password" /><br />
    Store logon information?<input id="Checkbox1" type="checkbox" /><br />
    <input id="Submit1" type="submit" value="logon"
    onclick="return Submit1_onclick()" onclick="return Submit1_onclick()" /></div>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,595
    Ask yourself what does ASP have to do with JavaScript?
    If your post falls off the page, bump it. ...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles