Hello, here is my problem: I have a navigation bar that I have embedded on my pages (to save update time): < embed width="100%" height="200px" src="header.html"></embed> In the header I have my links, which I have assigned ids: < a href="index.html" class="top" id="home">Home</a> Then I have this javascript: function changeCssClass(objDivID) { if(document.getElementById(objDivID).className=='topOn') { document.getElementById(objDivID).className = 'top'; } else { document.getElementById(objDivID).className = 'topOn'; }} Which works perfectly with this on index.html: < body onload="changeCssClass('home')"> Creating the affect that, on the home page, you know you are on the home page because "home" has a different class style. Now when I said it works perfectly, I lied. It works perfectly when the header is not embedded. My question is, how can I get the javascript to target the embedded div ids? Or is there another way to approach this?
In all my years of web development, I have never heard of anybody <embed 'ing an html file. If your files are php, just use <?php include 'header.html'; ?> If they arn't php, I suggest you do some research on it, It might be time to update the site
most web server has a server-side solution for including files (without using PHP or some sort of server-side language). example - if you're running Apache, you can use the mod_include module and write: <!--#include file="header.html" --> http://httpd.apache.org/docs/1.3/howto/ssi.html
if this works, it deserves some rep for groundbreaking forward thinking! /me goes to embed random objects and elements in an attempt to break IE