Just a heads up, I didn't write all of the web-page code so I'm not exactly sure what pdiv
is. But I want to see if I can fix this small issue [making text color change when clicked on to show which section you're reading].
This particular section looks like this:
https://i.sstatic.net/EDem4.png
and when you click on it, it will display all menu sections:
https://i.sstatic.net/WTa4o.png
function menuShowPol(pdiv){
if(document.getElementById('menu_pol_div'+pdiv).
style.display=="none") {
document.getElementById('menu_pol_div'+pdiv)
.style.display = "inline-block";
} else {
document.getElementById('menu_pol_div'+pdiv)
.style.display = "none";
}
}
function changeColor(pdiv){
{
document.getElementById('menu_pol_div'+pdiv)
.style.color = "#ff0000"; // forecolor
document.getElementById('menu_pol_div'+pdiv)
.style.backgroundColor = "#ff0000"; // backcolor
}
if($showpol==1){
$menutext .= "<div id=\"country_menu_report_name\"
onclick=\"menuShowPol('".$pol."');
changeColor('".$pol."'); return
false;\">".$thispol."</div>\n";
Is there any way to achieve this using only CSS? Or if JavaScript is required, can you offer some assistance? Thank you.