I have a set of pages on my site that I want to connect with a tabbed navbar so that as each tab is clicked, the page reloads with the appropriate data. I also want the button clicked to be properly highlighted to show which page it currently selected.

I have a set of buttons with 3 states, regular, over and on. I have set the mouseover, mouseout events to call the gif based on the appropriate state within the <img> tags. I want to write the code to use the "on" state based on the form loaded -- this will require a little bit of coding.

I think I can set all this up BUT -- I really want to put all this in an include file and call it in the appropriate place on each page. What I don't know is how to format the include file. Is it a file with the button img code within the <html></html> tags (only)? All the include files I've used have been code only, no images.

Can someone point me in the right direction? Can this be done?

I assume you already have a server-side method for your inclusion (PHP, or SSI), and that your question is soley "what do I put in the external file": just the HTML code itself should work fine.

If you want an "almost" completely client-side solution, then you can set the contents of your nav element via JavaScript, and include the js with standard syntax:

<script type="text/javascript" src="myNavBar.js"></script>

Place that in the head of your document. The JavaScript file will contain everything except the "script" tags. The code within the JavaScript will "set" the contents of your navbar element.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.