|
Posted by Ed Mullen on 08/29/06 00:45
fraternitydisposal@gmail.com wrote:
> Ed Mullen wrote:
>> fraternitydisposal@gmail.com wrote:
>>> I'm making a personal site which contains links like home, resume,
>>> feedback, hobbies, links in every page. And i've managed to create an
>>> external css. How can i insert the said links in every page without
>>> copying and pasting the links in every page?
>>>
>>> My webhost doesn't support server side scripting. Can i store the links
>>> in an external file and insert them by client side scripting? Please
>>> help.
>>>
>> You could put the menu (links) in an external file and have it inserted
>> dynamically into each page via javascript. The pluses are that it
>> doesn't rely on server-side functions and you can change one file and
>> have it change every page on your site. The minus is that visitors must
>> have javascript enabled for your pages to work properly. You may well
>> see lots of negative comments in html and css newsgroups about
>> javascript. I personally find most of the concerns unfounded.
>>
>> My site uses this technique. I have a header that is used on every
>> page. The content of the header is several buttons containing the menu
>> navigation system. All of the header info comes from the same file. To
>> change the menu on 200+ pages on my site I change just one or two files.
>>
>> See Design Considerations at: http://edmullen.net/siteinfo.html
>>
>> --
>> Ed Mullen
>> http://edmullen.net
>> http://mozilla.edmullen.net
>> http://abington.edmullen.net
>> Chastity is curable if detected early.
>
> This is what I'm looking for. But i'm failing to understand and modify
> your javascript to fit my needs. I possible mention a good source to
> learn javascript.
>
Elsewhere you said you didn't need drop-down menus. So, all you need
from my method is to use
<script src="yourfile.js" type="text/javascript"></script>
in the <body> section of your page where you want the content to appear.
Then create a file (e.g., yourfile.js) and use the following to put the
content you want to appear on each page.
var writeExternalContent = '';
writeExternalContent += '<a href="link1.html">Link1</a>';
.... etc ...
document.writeln(writeExternalContent)
Here's a test case: http://edmullen.net/temp/t1.html
Here's the js file: http://edmullen.net/temp/yourfile.js
As to tutorials on javascript, I'd go to the bookstore and get a basic
book to start with.
--
Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
Error: Keyboard not attached. Press F1 to continue ...
Navigation:
[Reply to this message]
|