...

View Full Version : External js File For a Background



Akuma
01-09-2007, 07:16 PM
Firstly, sorry if my title description is vague but it was the best I could describe my little problem. :)

I am creating a new web site and the background for all the pages is going to be the same. I don't want to have to add the background for each page using background properties html code.

On my last web site I had used a js file which I placed on my server together with a little code on each page which called that js file, similar to the code below:


<script language="javascript" src="background.js"></script>

The problem is I had gotten rid of the js code and file on the last site and I don't remember what the coding I used was (in particular the coding in the background.js file). If anyone could help me out it would be greatly appreciated. :)

felgall
01-09-2007, 07:22 PM
The background should be defined in an external stylesheet. There is no need for Javascript to do this as it is appearance and not behaviour that you are trying to define and appearance is defined by the stylesheet (placing it in the HTML is deprecated and is no longer the way to do it).

Akuma
01-09-2007, 08:19 PM
The background should be defined in an external stylesheet. There is no need for Javascript to do this as it is appearance and not behaviour that you are trying to define and appearance is defined by the stylesheet (placing it in the HTML is deprecated and is no longer the way to do it).

How do I go about creating an external stylesheet? I have no experience in using stylesheets but if there's any basics about on the subject I don't mind reading up on it. :)

SpirtOfGrandeur
01-09-2007, 08:22 PM
Here (http://www.htmlhelp.com/reference/css/style-html.html) appear to be a few examples...

Pyth007
01-10-2007, 12:58 AM
Also, here (http://www.w3schools.com/css/default.asp) is W3Schools' tutorial on CSS... I noticed that the second example (in the CSS Examples section) goes into how to set a background image!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum