Free AdviceGet Free Advice
Home | Get advice | Give advice | Topics | Columnists | - !START HERE! -
Make Suggestions | Sitemap

Get Advice


Search Questions

Ask A Question

Browse Advice Columnists

Search Advice Columnists

Chat Room

Give Advice

View Questions
Search Questions
Advice Topics

Login

Username:
Password:
Remember me
Register for free!
Lost Password?

Want to give Advice?

Sign Up Now
(It's FREE!)

Miscellaneous

Shirts and Stuff
Page Backgrounds
Make Suggestions
Site News
Link To Us
About Us
Terms of Service
Help/FAQ
Sitemap
Contact Us


Menu Difficulties


Question Posted Friday October 8 2004, 1:38 am

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.


[ Answer this question ]
Want to answer more questions in the Technology category?
Maybe give some free advice about: Internet & Web Design?


metawidget answered Tuesday October 12 2004, 2:09 am:
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.

[ metawidget's advice column | Ask metawidget A Question
]




The_MoUsY_spell_checker answered Friday October 8 2004, 5:03 am:
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 &lt;!--#include file="yourfilename.txt" --&gt; 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...

[ The_MoUsY_spell_checker's advice column | Ask The_MoUsY_spell_checker A Question
]



DruidX answered Friday October 8 2004, 5:01 am:
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].

[ DruidX's advice column | Ask DruidX A Question
]

More Questions:

<<< Previous Question: wo . my second bored about thisz . . . . .
Next Question >>> my parents

Recent popular questions:
Want to give advice?

Click here to start your own advice column!

What happened here with my gamer friends?

All content on this page posted by members of advicenators.com is the responsibility those individual members. Other content © 2003-2014 advicenators.com. We do not promise accuracy, completeness, or usefulness of any advice and are not responsible for content.

Attention: NOTHING on this site may be reproduced in any fashion whatsoever without explicit consent (in writing) of the owner of said material, unless otherwise stated on the page where the content originated. Search engines are free to index and cache our content.
Users who post their account names or personal information in their questions have no expectation of privacy beyond that point for anything they disclose. Questions are otherwise considered anonymous to the general public.

[Valid RSS] eXTReMe Tracker