Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to have something standard on every page

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
In my website I want every page to have the same set of links down the side. Would the best way to do this be to have a javascript file with lots of document.write(statements) in it that I could reference in every html document.

Thanks in advance,

Chris
 
hie
it is not allways document.write, u can also use frames (iframes) or layers (divs)
if u're interested, i think i or anybody else wuld xplain smth 2 u..
regards, vic
 
Using SSI to include the html with the links would probably be the easiest way to solve the problem. DO a search for SSI or "server side includes". Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I had quick look at it and it doesn't look nice. I may just stick to .js. But the only thing I need to know if its alright to create javascript with javascipt.

 
It does make sense, and I believe it will work

document.write(&quot;<script>function meow(){return true;}</script>&quot;);
 
If you have a javascript file that you want to reference in lots of documents, save it as a separate file (without the script tags) and include it like this:
Code:
<script language=&quot;javascript&quot; src=&quot;mystuff.js&quot;></script>
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Can you reference an external file from an external file?

menu.js:
document.write(&quot;<script src=\&quot;rollover.js\&quot;></script>&quot;);

I know you can write script to a document (via document.write in a external .js), but i don't know if you can document.write a call to an external script. No time to try it now!

Sorry
 
I would say use server side includes...all you have to do is put
Code:
<!-- #include file=&quot;whatever.htm&quot; -->

And in that section, where you have that include statement, it will put the htm file of your menu in there...dont hassle with javascript...do it the easy way.
Regards,
AnthLOLny
----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
I agree with WhiteTiger. I use SSI for my left menus as well. Makes it VERY easy and less clutter on my page. Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
hie
>>gerrygerry yes, u can, but use write(&quot;</&quot;+&quot;script>&quot;) instead, 'coz &quot;</script>&quot; wuld be read as clasing tag, & u'll get an error..

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top