Register, Login, and Logout
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// This script is designed to support at a minimum IE 6
|
||||
//
|
||||
// All menu functions are defined outside of initMenu.
|
||||
//
|
||||
// This is so I'm not duplicating functions between-
|
||||
// checks for what browser we have
|
||||
|
||||
function doLogoutAction() {
|
||||
var logoutForm = document.getElementById("Form_Auth_Logout");
|
||||
logoutForm.submit();
|
||||
}
|
||||
|
||||
// Once the page has fully loaded, connect each button to its code
|
||||
function initMenu() {
|
||||
var logoutButton = document.getElementById("Menu_Auth_Logout");
|
||||
|
||||
if(window.addEventListener) {
|
||||
logoutButton.addEventListener("click", doLogoutAction);
|
||||
} else {
|
||||
logoutButton.attachEvent('onclick', doLogoutAction);
|
||||
}
|
||||
}
|
||||
|
||||
// Register load / onload event
|
||||
if(window.addEventListener) {
|
||||
window.addEventListener('load', initMenu);
|
||||
} else if(window.attachEvent) {
|
||||
window.attachEvent('onload', initMenu);
|
||||
} else {
|
||||
alert("Unsupported browser.");
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// really simple IE6 compatible post function
|
||||
|
||||
function PostToEndpoint(url, params) {
|
||||
var form = document.createElement("form");
|
||||
form.method = "POST";
|
||||
form.action = url;
|
||||
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = key;
|
||||
input.value = params[key];
|
||||
form.appendChild(input);
|
||||
}
|
||||
}
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
Reference in New Issue
Block a user