Can I add javascript to a stylesheet?

N

nelly-knowall

I am just about ok with html. Much less so with css. I have however used a
style sheet to link most of the pages in my website
--
Website http://www.tbandu.co.uk (TBandU short for Tuberculosis and You)

My question is:
I would like to add the following code for a visitor counter to my site
**********************************************************
<!-- Start of StatCounter Code -->
<script type="text/JavaScript" language="JavaScript">
var sc_project=2736896;
var sc_invisible=0;
var sc_partition=0;
var sc_security="";
</script>

<script type="text/JavaScript" language="JavaScript"
src="http://www.statcounter.com/counter/counter.js"></script><noscript><a
href="http://www.statcounter.com/" target="_blank"><img
src="http://c1.statcounter.com/counter.php?sc_project=273686&amp;java=0&amp;security=&amp;invisible=0"
alt="free web stats" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
*********************************************

Is it possible to add it to my stylesheet? and if so how. Or will I have to
manually add it to every page?
Please bear in mind I am probably a 3 out of 10 in understanding css so
please keep replies "in english"
Thanks very much in advance and hope you never have to use my site!!!!
 
R

RobG

nelly-knowall said on 16/03/2006 11:46 AM AEST:
I am just about ok with html. Much less so with css. I have however used a
style sheet to link most of the pages in my website


Putting the character sequence dash-dash-space-return at the start of a
line tells news reader programs that what follows is a signature block.
Everything below it is not quoted in a reply.

When I press 'reply' in my news reader, the new message contains only
the lines above, the rest I have to manually quote (bummer... I ain't
gunna) :)

Anyhow, to answer your question: No.

The content of style and script elements is passed as-is to browser
program components for evaluation. The components expect to get valid
style rules or script statements respectively.

A style element (or external stylesheet) must follow the syntax rules
for CSS. You can't just randomly add HTML script elements or statements
inside style elements any more than you can randomly add CSS inside a
script element.

Having said that, CSS does support processing instructions to different
degrees in some browsers (and mostly for XML), but they are no
replacement for JavaScript and certainly should not be relied on by a
publicly accessed web site.
 
N

nelly-knowall

Sorry I don't understand the beginning of your reply dash dash dash stuff.
I put them in my original question. I didn't realise I was doing something
wrong
I understand the "no". But don't really understand the rest of your reply.
But thanks anyway.
 
T

Thomas 'PointedEars' Lahn

nelly-knowall wrote:
^^^^^^^^^^^^^
So you know all?
I am just about ok with html. Much less so with css. I have however used
a style sheet to link most of the pages in my website

Interesting. (As in the curse: "May you live in interesting times."[1])

You have a rather long signature. You want to change this, trust me.


PointedEars
___________
[1] Which is _not_ a Chinese proverb, but probably of U.S. American origin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top