A
ameshkin
Hi Everybody,
I'm just now learning javascript and I'm using mootools. What I want
to do is to dynamically load a php page into accordian panel 2,
depending on which radio button is selected in accordian panel 1.
Here is a simplified version of my code.
window.addEvent('domready', function() {
var accordion = new Accordion('h3.atStart', 'div.atStart', {
display: 0, //will open the 1st panel at start
opacity: false,
onActive: function(toggler, element){
toggler.setStyle('color', '#000000');
},
onBackground: function(toggler, element){
toggler.setStyle('color', '#222');
}
}, $('accordion'));
//Open Accordion Panels
$('next1').addEvent('click', function() {
accordion.display(1);
});
$('next2').addEvent('click', function() {
accordion.display(2);
//AjxCln();
});
$('next3').addEvent('click', function() {
accordion.display(3);
});
$('next4').addEvent('click', function() {
accordion.display(4);
});
$('prev1').addEvent('click', function() {
accordion.display(0);
});
$('prev2').addEvent('click', function() {
accordion.display(1);
});
$('prev3').addEvent('click', function() {
accordion.display(2);
});
$('prev4').addEvent('click', function() {
accordion.display(3);
});
});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value
+"'");
if (restore) selObj.selectedIndex=0;
}
var accordion;
var accordionTogglers;
var accordionContents;
window.onload = function() {
accordionTogglers = document.getElementsByClassName('accToggler');
accordionTogglers.each(function(toggler){
//remember the original color
toggler.origColor = toggler.getStyle('background-color');
//set the effect
toggler.fx = new Fx.Color(toggler, 'background-color');
});
accordionContents = document.getElementsByClassName('accContent');
accordion = new Fx.Accordion(accordionTogglers, accordionContents,{
//when an element is opened change the background color to blue
onActive: function(toggler){
toggler.fx.toColor('#6899CE');
},
onBackground: function(toggler){
//change the background color to the original (green)
//color when another toggler is pressed
toggler.setStyle('background-color', toggler.origColor);
}
});
}
function AjxCln() {
//new code below for ajax
var showSuccess = new function(req){
alert(req);
};
//a GET request
//new XHR({method: 'get', onSucces: showSuccess}).send('location/
myscript.php', 'answerme=1&q=test');
//find out which radio button was checked
var a1 = document.getElementById('svc_tp_1').checked; //these are the
radio buttons, depending on which one is checked, I want the variable
PAGE to be a different number. The php file will determine what
content to show based on what $page is equal to!
var a2 = document.getElementById('svc_tp_2').checked;
if (a1 == true) {
var page = '1';
} elseif(a2 == true) {
var page = '2';
} else {
}
//POST ajax
new XHR({onSuccess: showSucces}).send('AJAX/step-2.php', 'page=' +
page);
//above code ajax
}
I'm just now learning javascript and I'm using mootools. What I want
to do is to dynamically load a php page into accordian panel 2,
depending on which radio button is selected in accordian panel 1.
Here is a simplified version of my code.
window.addEvent('domready', function() {
var accordion = new Accordion('h3.atStart', 'div.atStart', {
display: 0, //will open the 1st panel at start
opacity: false,
onActive: function(toggler, element){
toggler.setStyle('color', '#000000');
},
onBackground: function(toggler, element){
toggler.setStyle('color', '#222');
}
}, $('accordion'));
//Open Accordion Panels
$('next1').addEvent('click', function() {
accordion.display(1);
});
$('next2').addEvent('click', function() {
accordion.display(2);
//AjxCln();
});
$('next3').addEvent('click', function() {
accordion.display(3);
});
$('next4').addEvent('click', function() {
accordion.display(4);
});
$('prev1').addEvent('click', function() {
accordion.display(0);
});
$('prev2').addEvent('click', function() {
accordion.display(1);
});
$('prev3').addEvent('click', function() {
accordion.display(2);
});
$('prev4').addEvent('click', function() {
accordion.display(3);
});
});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value
+"'");
if (restore) selObj.selectedIndex=0;
}
var accordion;
var accordionTogglers;
var accordionContents;
window.onload = function() {
accordionTogglers = document.getElementsByClassName('accToggler');
accordionTogglers.each(function(toggler){
//remember the original color
toggler.origColor = toggler.getStyle('background-color');
//set the effect
toggler.fx = new Fx.Color(toggler, 'background-color');
});
accordionContents = document.getElementsByClassName('accContent');
accordion = new Fx.Accordion(accordionTogglers, accordionContents,{
//when an element is opened change the background color to blue
onActive: function(toggler){
toggler.fx.toColor('#6899CE');
},
onBackground: function(toggler){
//change the background color to the original (green)
//color when another toggler is pressed
toggler.setStyle('background-color', toggler.origColor);
}
});
}
function AjxCln() {
//new code below for ajax
var showSuccess = new function(req){
alert(req);
};
//a GET request
//new XHR({method: 'get', onSucces: showSuccess}).send('location/
myscript.php', 'answerme=1&q=test');
//find out which radio button was checked
var a1 = document.getElementById('svc_tp_1').checked; //these are the
radio buttons, depending on which one is checked, I want the variable
PAGE to be a different number. The php file will determine what
content to show based on what $page is equal to!
var a2 = document.getElementById('svc_tp_2').checked;
if (a1 == true) {
var page = '1';
} elseif(a2 == true) {
var page = '2';
} else {
}
//POST ajax
new XHR({onSuccess: showSucces}).send('AJAX/step-2.php', 'page=' +
page);
//above code ajax
}