Any way to call variables from outside a JavaScript file?

I’m doing a site for a client who needs to update a very small amount of text (and a link) on a regular basis.

The text and link need to be on every page, so to facilitate this I’ve got a JavaScript file that’s called by each HTML file. Thing is, I want to make it really easy for him to update, so rather than have him tinkering around inside the .js file, I’d rather use a simple .txt (or .js) file that he can just enter the link and text into. I don’t know of any way in JS to call in another file.

Anyone got any ideas? I can’t use Perl or ASP or CFM or anything like that - it’s HTML and JS only.

server side includes possible? that would do it, sorta like a .h file in C but for html…

I just tried this and it worked with IE. YMMV I created two separate .js files, included them both into the HTML like thus:
file1.js:



var test1 = "This is a test";


file2.js



document.write("Value: " + test1);


And the HTML includes them both:

HTMLFile:



<html><body>
	<script type="text/javascript" src="file1.js"></script>
	<script type="text/javascript" src="file2.js"></script>
</html></body>


This, in IE reported:
Value: This is a test

Therefore you could have a very simple JS file that your guy CAN edit:



var strURL = "http://www.fatchicksinpartyhats.com";
var strText = "I love fat chicks in party hats!";


That should be an easy enough file for him to play with, yes?

Steve

Yes, it works. But this creates a user dependency. Anyone visiting the web site with JavaScript turned off will not see the content you are attempting to display.

Go the SSI route. It’s the better option. It’s professional. It’s the correct way to go.

What technology are you using? Server side is definitely the way you want to go. If you’re using something that supports ASP or JSP, you could make a simple file that is parsed and loaded into application variables. Then just include them on each page.

Can’t do server-side. It’s JavaScript or nothing.

Don’t care about the JS being off - that’s not my problem. Anyway, it’s for a travel agency, so the site isn’t going to

Big Ole Steve has what I’m going to do - it came to me too as I was brushing my teeth last night.

Thanks for everyone’s advice!