PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//This is javascript
function changeTab(mgObj){
// Making all background colors blue
for(i=0; i<tabs.length; i++){
tabsїi].style.backgroundColor = 'blue';
rightїi].style.backgroundColor = 'blue';
leftїi].style.backgroundColor = 'blue';
}
// Making the selected cells background black
rightїmgObj.name-1].style.backgroundColor = 'black';
leftїmgObj.name-1].style.backgroundColor = 'black';
mgObj.style.backgroundColor='black';
switch (mgObj.name){
case "1":
exercises.style.display="none";
chest.style.display="";
break;
default:
exercises.style.display="";
chest.style.display="none";
break;
}
// here is where the div refresh should occur
tabs.innerHTML = //PHP FUNCTION GOES HERE
}
I don't know if you can do that, since the PHP is interpretted before the JavaScript is executed.
You might have to have PHP write out any data you need into JavaScript containers so that your JavaScript functions can use that info later in your div refresh.
I had to do this exact thing for a project at work, mine does a DB pull using PHP and writes it , via echo to javascript array's which in turn are used to populate a form. I looked every where and this was the easiest way to do it.