Results 1 to 4 of 4

Thread: need a little help please

  1. #1
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need a little help please

    Can some one tell me what i'm doing wrong because when you click on the submit button it goest to the page but don't pass the login info to the page.

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript" language="JavaScript">

    function ActionDeterminator()
    {
    if(document.login.location[0].checked == true) {
    document.login.action = 'http://69.90.113.202/Templates/Default/login.aspx';
    }
    if(document.login.location[1].checked == true) {
    document.login.action = ' http://panel.greatlakegaming.net/Tem...ult/login.aspx ';
    return true;
    }
    // -->
    </script>

    </head>

    <body>
    <form name="login" method="POST" action="">

    <table border="0" align="center" id="table1">
    <tr>
    <td><strong>User:</strong></td>
    <td><input type="text" name="USERID" size="20"></td>
    </tr>
    <tr>
    <td height="27"><strong>Password</strong>:</td>
    <td><input type="password" name="PASSWORD"
    size="20"></td>
    </tr>
    <tr>
    <td height="59" valign="top"><strong>Location:</strong></td>
    <td valign="middle">
    <input name="location" type="radio" checked>
    Chicago<br> <input type="radio" name="location">
    New York<br>
    </td>
    </tr>
    </table> <p>&nbsp;</p>
    <p align="center">
    <input type="submit" value="Submit" name="B1"
    onClick="return ActionDeterminator();">
    <input type="reset" value="Reset"
    name="B2">
    </form>


    </body>
    </html>

  2. #2
    Join Date
    Nov 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by gmilazzo
    function ActionDeterminator()
    {
    if(document.login.location[0].checked == true) {
    document.login.action = 'http://69.90.113.202/Templates/Default/login.aspx';
    }
    if(document.login.location[1].checked == true) {
    document.login.action = ' http://panel.greatlakegaming.net/Tem...ult/login.aspx ';}
    return true;
    }
    Add a '}' as this code, that's allright !
    Good luck!

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Also, one usually uses the form's onsubmit event, rather than the submit button's onclick event. This allows for other ways of submitting the form (e.g. pressing enter). In addition to this, you should really give an action in plain HTML first, for non-Javascript browsers.
    Code:
    <html>
      <head>
        <title>Untitled Document</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <script type="text/javascript">
          function ActionDeterminator() {
            document.forms['login'].action = document.forms['login'].elements['location'].value;
            return true;
          }
        </script>
      </head>
      <body>
        <form name="login" method="POST" action="http://69.90.113.202/Templates/Default/login.aspx" onsubmit="return ActionDeterminator();">
          <table border="0" align="center" id="table1">
            <tr>
              <td><strong>User:</strong></td>
              <td><input type="text" name="USERID" size="20"></td>
            </tr>
            <tr> 
              <td height="27"><strong>Password</strong>:</td>
              <td><input type="password" name="PASSWORD" size="20"></td>
            </tr>
            <tr>
            <td height="59" valign="top"><strong>Location:</strong></td>
              <td valign="middle"> 
                <input name="location" value="http://69.90.113.202/Templates/Default/login.aspx" type="radio" checked="true"/> Chicago<br>
                <input type="radio" value="http://panel.greatlakegaming.net/Templates/Default/login.aspx" name="location"/>
                New York<br>
              </td>
            </tr>
          </table> <p>&nbsp;</p>
          <p align="center"> 
            <input type="submit" value="Submit" name="B1"/>
            <input type="reset" value="Reset" name="B2"/>
          </p>
        </form>
      </body>
    </html>
    Last edited by Twey; 11-19-2005 at 02:19 PM. Reason: Cleaned up the code a little.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks guys for the help

Bookmarks

Posting Permissions

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