Anbei der Code um ein Loginformular für das Anmeldemodul zu erstellen.
Below you will find the code to create a login-form for the login-module.
<SCRIPT language="vb" runat="server">
Sub Page_load()
'----------------------------------------------------------------------
' Javascript event-handler will be related to the input field
' to capture the return-key event.
'----------------------------------------------------------------------
username.Attributes.Add("onkeypress", "mykeyhandler('" & send.ClientID & "')")
password.Attributes.Add("onkeypress", "mykeyhandler('" & send.ClientID & "')")
if context.items("lang") <> 1 then
send.text = "Loggin"
else
send.text = "Anmelden"
end if
End Sub
</SCRIPT>
<SCRIPT language="JavaScript" type="text/javascript">
//----------------------------------------------------------------------
// Event handler who is waiting for return-keycode at the username
// and password field to call a postback for the login button
//----------------------------------------------------------------------
function mykeyhandler(sender) {
if (window.event.keyCode == 13) {
mysender = sender;
event.returnValue=false;
try {
document.getElementById(sender).click();
} catch(e) {}
}
}
if (document.captureEvents)
{
window.captureEvents(Event.KEYPRESS);
window.onkeypress = handlenetscape;
}
function getReturnValue(e)
{
if (!document.captureEvents)
return true;
else
{
if (e==13)
return false;
else
return true;
}
}
function handlenetscape(e)
{
if (e.which == 13){
__doPostBack('<%=send.UniqueID.replace(":","$") %>',''); } }
//----------------------------------------------------------------------
// Script which gives the focus to the username field when page is loaded,
// and if no username was entered in the username field, it will be
// prepared with the guest login.
//----------------------------------------------------------------------
function focusInput() { document.getElementById('<%=username.clientid %>').focus();
if(document.getElementById('<%=username.clientid %>').value.length < 1) {
if(<%=context.items("lang")%> == 1) {
document.getElementById('<%=username.clientid %>').value='';
document.getElementById('<%=password.clientid %>').value='';
}
else {
document.getElementById('<%=username.clientid %>').value='';
document.getElementById('<%=password.clientid %>').value='';
}
}}
</SCRIPT>
<DIV class="login_form">
<DIV class="center warning"><SPAN [mvif:haserror:neq:]>[pfl:1:Error in logging in][pfl:2:Login error]!</SPAN>[nbsp]</DIV>
<DIV class="login_label"><SPAN class="lauftext">[pfl:1:User][pfl:2:User]:</SPAN></DIV>
<DIV class="login_input">[tb:username:class="login_input"]</DIV>
<DIV class="login_label"><SPAN class="lauftext">[pfl:1:Password][pfl:2:Password]:</SPAN></DIV>
<DIV class="login_input">[tb:password:TextMode="password" class="login_input"]</DIV>
<DIV class="login_label">[nbsp]</DIV>
<DIV class="login_button">[lbn:send:commandName="Update" text="Login"]</DIV></DIV>
<SCRIPT language="Javascript">
document.body.onLoad=focusInput();
</SCRIPT>
Keine Kommentare:
Kommentar veröffentlichen