Possible Duplicate:
How to change/remove CSS classes definitions at runtime?
I have a HTML page which uses external css file .I want to change css rules of external file using javascript at runtime.
myHtml.html
<html>
<head>
<link rel="stylesheet" href="myCSS.css" type="text/css">
<script type="text/ecmascript" src="myJS.js" />
</head>
<body>
<p> change css style color for this element using javascript </p>
</body>
</html>
myCSS.css
.p{ color:blue}
myJS.js
var ss = document.styleSheets[0]
var firstRule = ss.rules[0] // null
I want to perform the operation :
firstRule.style.color = "red" ;