View Full Version : writing the same info/text to HTML from one source

03-07-2013, 09:41 AM
I've spent several hours (over days) trying to find a solution to this probably very simple piece of code.

I want to display a version number in at least two places on all the pages of the site running to about 20 so far... Currently using Notepad++ 'find and replace' to change this version number but have on occasion missed a page or two.

The site sits on a business Intranet and also is likely to be distributed on disk for standalone/local LANs, so no access to server side stuff technology that I know of. Below is an sample layout of what I mean. The version number may even crop up in the content text when being referred to.


I have tried all sorts of code abominations cut and pasted from the web, this one below being one I tried from scratch to no avail:

In my HTML <head>

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

Content of the referenced .js file

var myText = "1.7.0";

within my <body> where I want the version number to appear

<script type="text/javascript">document.write(myText);</script>

I had a go, got completely lost in all this, I really hope some one can help.

with anticipated thanks,


03-08-2013, 12:39 AM
This would be simpler using a server-side language (like PHP). Your text editor is probably your next-best-bet, however. I believe notepad++ has a "find in files" search & replace function...?

03-08-2013, 10:34 AM

thanks for your response, I would have preferred to have gone the PHP route (includes) but the html files are sent to someone else and then hosted on MS Windows based servers (ASP??) and accessed via share point on our business intranet. Also the website pages are to be distributed via CD/DVD for stand alone PCs.

I currently use the 'find/replace' tool in Notepad++ with all the docs open at once, but I was just wondering if this could be done using javascript and then I only have one file (the .js) to amend.



03-08-2013, 02:07 PM

my error was that my linked file in my <head>:

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

wasn't linked properly, it should have been

<script type="text/javascript" src="scripts/version.js"></script>
as I'd put it in a "scripts" folder/directory. All the other code is unchanged. If there is a better practise (semantically) I'd be interested to see it.

Thanks for watching.