Dear Ern Marshall,
style sheets mean exactly style sheets: they are intended to format your
code, not to store it; if you wish to store a piece of code to apply on more
than one page, you can use:
-server side includes (if your server provides them);
-php or asp to generate it;
-external client side scripts (javascript, vbscript);
-or pieces of inner html that also require scripting.
Over them, you can apply any style sheet you want.
A very simple script to attach to the page to write your links would be
something like:
var a='<a href="myfirstpage.html" class="linkstyle">My First Link</a>'
var b='<a href="secondpage.html" class="linkstyle">My Second Link</a>'
car c='<p>'+a+' '+b+'</p>'
(you may find some validation errors on this, you can clean it using escape
characters or dividing the expression in smaller expressions so that ending
tags will not appear orphaned)
if you save this code as mylinks.js and then call the script to the head of
your page with a
<script src="myjsfolder/myscript.js" type="text/javascript"></script>
and if you put at the place you want the footer to appear (at the bottom of
your content) the code
<script type="text/javascript">
document.write(a);
</script>
you will get a paragraph with your links on that place, written upon page
load.
If you prefere not to add code outside the head of the html file, you will
need to let your script detect the place where you want to put your links.
The easyest way to do that seams to be to use a span (or a div):
giving a span an id you can make id able browsers look for the span and
insert the markups piece you want:
so in your span you can make: <span id="insert"></span>
and in the external script something like:
var a='<a href="myfirstpage.html" class="linkstyle">My First Link</a>'
var b='<a href="secondpage.html" class="linkstyle">My Second Link</a>'
var c=a+' '+b
//(since <p></p> is a block element you shouldn't use it inside a span)
//now the script will need to check for browsers capabilities
if (document.all){document.all.insert.innerHTML=c}
else if
(document.getElementById){document.getElementById("insert").innerHTML=c}
else document.write(c)
on the last option, if the browser doesn't handle inner html nor
document.getElementById it will write your footer anyway, just not at its
place, (actually at the top of the document, wich is not so nice) since it
doens't know where to put it.
It is also possible, on modern browsers to generate the code on load using
thedocument object model.
Anyway, it seams to me that if you want your site to comply the standards
and to be accessible (javascript links are not) you should look at your
server to know what server side technologies they provide and use them, or
simply write the links on the bottom of the page (it just one mark up line
anyway, just a simple copy paste, and it will save the loading of a script).
Hope it Helps,
Isabel Santos
----- Original Message -----
From: "Ern Marshall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 06, 2004 12:18 AM
Subject: [WSG] Footer
> I am very new to CSS, I have curently built a external style sheet for
> my page at
> http://www.hotkey.net.au/~marshalle/
> Which works very nicely, But I have tried to find out how to add a
> "footer" to the page.
> I.E. to place a link back to the "home page" and a link to my "guest
> book". This would be placed in the external style sheet so that it would
> appear on every page
> But to no avail....I just can't seem to get it right
> This is as far as I have got with the CSS
> http://www.hotkey.net.au/~marshalle/BASIC5.css
> Can you be so kind as to piont me in the right direction
>
> --
> Ern Marshall
> In Vietnam we have lived hours of fraternal, warm and exalting nobility.
Here for a few days we have ceased to be slaves and have really been men.
> It is hard to return to servitude.
> http://www.hotkey.net.au/~marshalle/
>
> *****************************************************
> The discussion list for http://webstandardsgroup.org/
> See http://webstandardsgroup.org/mail/guidelines.cfm
> for some hints on posting to the list & getting help
> *****************************************************
>
>
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************