thomas91
Goto Top

Formular nach ausfühlen mit Enter bestätigen

Guten Morgen,

ich habe hier ein Authentifizierungsportal für unser Guest WLAN. Welches nach ausfühlen des Benutzernamens und Kennwort nicht mit Enter bestätigt werden kann.
Dies hätte ich aber gerne hinzugefügt. Meine Javascript Kenntnisse sind bescheiden.

 

 <html>
<head>

<meta http-equiv="Pragma" content="no-cache"> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">   
<title>Herzlich Willkommen bei der Company</title>

<script>
function submitAction(){
      var link = document.location.href;
      var searchString = "redirect=";  
      var equalIndex = link.indexOf(searchString);
      var redirectUrl = "";  

      if (document.forms.action == "") {  
      var url = window.location.href;
      var args = new Object();
      var query = location.search.substring(1);
      var pairs = query.split("&");  
          for(var i=0;i<pairs.length;i++){
              var pos = pairs[i].indexOf('=');  
              if(pos == -1) continue;
              var argname = pairs[i].substring(0,pos);
              var value = pairs[i].substring(pos+1);
              args[argname] = unescape(value);
          }
          document.forms.action = args.switch_url;       
      }       
      if(equalIndex >= 0) {
            equalIndex += searchString.length;
            redirectUrl = "";  
            redirectUrl += link.substring(equalIndex);
      }
      if(redirectUrl.length > 255)
      redirectUrl = redirectUrl.substring(0,255);
      document.forms.redirect_url.value = redirectUrl;
      document.forms.buttonClicked.value = 4;
      document.forms.submit();
}

function loadAction(){
     var url = window.location.href;
     var args = new Object();
     var query = location.search.substring(1);
     var pairs = query.split("&");  
     for(var i=0;i<pairs.length;i++){
          var pos = pairs[i].indexOf('=');  
          if(pos == -1) continue;
          var argname = pairs[i].substring(0,pos);
          var value = pairs[i].substring(pos+1);
          args[argname] = unescape(value);
     }


     document.forms.action = args.switch_url;

     // This is the status code returned from webauth login action
     // Any value of status code from 1 to 5 is error condition and user
     // should be shown error as below or modify the message as it suits
     // the customer

     if(args.statusCode == 1){
        alert("Sie sind bereits eingeloggt, es ist keine weitere Aktion Ihrerseits erforderlich.");  
     }
     else if(args.statusCode == 2){
        alert("Sie sind nicht konfiguriert, um sich am Webportal zu authentifizieren. Von Ihrer Seite sind keine weiteren Maßnahmen erforderlich.");  
     }
     else if(args.statusCode == 3){
        alert("Der angegebene Benutzername kann zu diesem Zeitpunkt nicht verwendet werden. Vielleicht ist der Benutzer bereits im System angemeldet?");  
     }
     else if(args.statusCode == 4){
        alert("Falscher Benutzername und Passwort. Bitte versuchen Sie es erneut.");  
     }
     else if(args.statusCode == 5){
        alert("Der eingegebene Benutzername und Passwort Kombination ist ungültig. Bitte versuchen Sie es erneut.");  
     }
}

</script>

</head>

<body bgcolor=#FFFFFF topmargin="0" marginheight="0" onload="loadAction();">   
<form method="post"> <input TYPE="hidden" NAME="buttonClicked" SIZE="16" MAXLENGTH="15" value="0">   
<input TYPE="hidden" NAME="redirect_url" SIZE="255" MAXLENGTH="255" VALUE="">   
<input TYPE="hidden" NAME="err_flag" SIZE="16" MAXLENGTH="15" value="0">  

<table border="0" cellspacing="0" cellpadding="0" width="100%" >   
  <tr>
  <th>
    <!--
      Tabelle erste Zeile Firmenlogo
    -->  
  <IMG SRC="./my_logo_company.jpg" width=515 height=150 align="center">  
  </th>
  </tr>
  
  <tr>
  <th>
    <!--
      Tabelle zweite Zeile Nutzungsbedingungen
    -->
  <iframe src="./aup.html" width="800" height="450" scrolling="auto"></iframe>  
  </th>  
  </tr>
  <tr>
  <th>
    <!--
      Tabelle zweite Zeile Nutzungsbedingungen
    -->
  <br>
  <h3 align=center><font color="#000000">Bitte geben Sie Ihren Username/Passwort ein:</font></h3>  
  <h4 align=center><font color="#000000">Username<input type="TEXT" name="username" SIZE="25" MAXLENGTH="63" VALUE=""></font></h4>  
  <h4 align=center><font color="#000000">Passwort<input type="Password" name="password" SIZE="25" MAXLENGTH="63" VALUE=""></font></h4>  
  <h4 align=center><font size="5" color="#000000"><input type="button" name="Submit" value="Ich stimme den Nutzungsvereinbarungen zu" class="button" onclick="submitAction();"></h4></font><p></p>  
  <p>Für Unterstützung, kontaktieren Sie bitte den Administrator unter Tel.-Nr. (edv@company.de)</p>
  <IMG SRC="./my_footer_lauda.png" width="100%" align=center>  
  </td>
  </tr>
</table>
 
</body>
</html>


Der Button ist in Zeile: 116.

Über Hilfestellung würde ich mich sehr freuen.

MfG

Thomas

Content-Key: 243551

Url: https://administrator.de/contentid/243551

Printed on: April 23, 2024 at 09:04 o'clock

Member: colinardo
Solution colinardo Jul 14, 2014 updated at 08:44:21 (UTC)
Goto Top
Hallo Thomas,
den Passwort-Input in Zeile 115 so abändern:
<input type="Password" name="password" SIZE="25" MAXLENGTH="63" VALUE="" onkeyup="keyup(event)">
dann füge noch folgende JavaScript-Funktion hinzu:
function keyup(event){
  if (event.keyCode == 13 || event.keyCode == 10) {
    submitAction();
  }
}
Grüße Uwe
Member: Thomas91
Thomas91 Jul 14, 2014 at 08:45:18 (UTC)
Goto Top
Zitat von @colinardo:

Hallo Thomas,
den Passwort-Input in Zeile 115 so abändern:
> <input type="Password" name="password" SIZE="25" MAXLENGTH="63" VALUE=""
> onkeyup="keyup(event)">
> 
dann füge noch folgende JavaScript-Funktion hinzu:
> function keyup(event){
>   if (event.keyCode == 13 || event.keyCode == 10) {
>     submitAction();
>   }
> }
> 
Grüße Uwe

Vielen Dank für deine Hilfe!

Gruß Thomas