1
Hello.
I need the logo of the site to change according to the page the user visits.
I have a site made in PHP in which the top is a include. So I thought to change the logo via Javascript.
I put the ID="logo" in img and a ID in the body of the pages that will have a different logo. So I hoped that through the If/Else, checking whether or not ID in the body, the src image if it changed. But it’s not rolling. I’m not a programmer and I got here by searching in Google. rs
Here are my codes:
HTML
<img id="logo" src="<?=$img_dir?>/logo_ultraclimber-resgate.png" alt="Ultra Climber Treinamentos e Serviços" />
JS
<script type="text/javascript">
if ('body[id="treina"]') {
document.getElementById("logo").src='_include/images/logo_ultraclimber-treinamentos.png';
} if else ('body[id="serv"]') {
document.getElementById("logo").src='_include/images/logo_ultraclimber-servicos.png';
} else {
document.getElementById("logo").src='_include/images/logo_ultraclimber-resgate.png';
}
Thanks for the help! =]
As your menu is done ?
– César Sousa