|
Menu Difficulties I have homemade java-script buttons and I have the same ones, in the exact order on all my pages. Is there a way for me to code the HTML where I don't have to write out the whole, complete href reference and imgs tags on every single page? That way if I have to make a change I can do it in an external file and just upload it and POOF! new button or old button deleted. I guess what I am saying is, can you put an external HTML into an existing HTML? I don't want to end up using frames.
Thanks for any help you can give me.
[ ] Want to answer more questions in the Technology category? Maybe give some free advice about: Internet & Web Design?
You could write a button-making function in Javascript, something like this:
const BASEURL = "[Link](Mouse over link to see full location);;
function makeButton(image, path){
write("<a href=" + BASEURL+href " onMouseOver = 'this.src ="+BASEURL + "images/over/" +image+' onMouseOut = 'this.src ="+BASEURL + "images/out/" +image+'"><img src ='"+ BASEURL+ "images/out/"+image+"' lowsrc ="'+ BASEURL+ "images/over/"+image'" /></a>")
}
I don't recall if it's actually this.src you want to replace, but it sounds like you know how to code rollovers already. Then, when you want a button:
<script language="JavaScript">makeButton("home.png","home.html")
You can use PHP to include stuff if your server doesn't do server side includes... I don't know it well enough to give you the commands, but any introductory PHP text should give inserting HTML from an outside file as an example. ]
You can use server side includes if your web host supports them... Put the stuff that you want on every page on a text file, then put <!--#include file="yourfilename.txt" --> on each page that you want to include that file... You will have to save all of the pages in .shtml extension instead of .html... ]
I think the only way to do anything like that is by using CSS, but CSS buttons only work in anything that isn't IE. Maybe you should consider asking yourself if you really need the java buttons [I assume they are only java cuz they change when rolled over]. ]
More Questions: |