I have two different side-panels with different settings, but would like to use one "login" form to access either depending on whether I clicked link A or B. So, I need to use the original string from either links' onclick attribute to change the onclick attribute of the "login" form so I can then pass that string into the function it uses.
I am admit-tingly a newb, albeit a quick learner. I am missing something here and can't figure it out, and may even be going in the wrong direction, so if I am please straighten me out! :)
Link A
<a href="#" id="leftOpen" onclick="openLogin(leftPanel)"></a>
Link B
<a href="#" id="rightOpen" onclick="openLogin(rightPanel)"></a>
Login Link
<a href="#" id="loginBtn" onclick="openPanel()"></a>
Login Link should be this after first function if clicked Link A
<a href="#" id="loginBtn" onclick="openPanel(leftPanel)"></a>
Functions
function openLogin(panel){
var panel;
$("#login").css("z-index", "1000");
$("#login").addClass("show");
document.getElementByID("#loginBtn").setAttribute("onclick","openPanel(\" . panel . \")");
};
function openPanel(open){
var open;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
result=xmlhttp.responseText;
if (result == 0) {
$("#login").css("z-index", "-1");
$("#login").removeClass("show");
$("#" . open).addClass("openSettings"); // Got to be something wrong here!
document.getElementById("pwd").value='';
}
else {
alert("The password entered is incorrect.")
document.getElementById("pwd").value='';
}
}
}
var url="../somewhere/mychk.php?pwd="+document.getElementById("pwd").value;
xmlhttp.open("GET",url,true);
xmlhttp.send();
};
+, not.