How can I modify external stylesheet by valuses i m getting from any oher page
<style type="text/css">
.heading {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 15px;
color: #666699;
text-decoration: none;
font-style: normal;
font-weight: bolder;
text-align: center;
}
.message {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bolder;
color: #666699;
text-decoration: none;
}
.footer {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bolder;
color: #666699;
text-decoration: none;
}
</style>
This is my stylesheet
<script language="javas cript">
var mysheet=documen t.styleSheets[0]
var myrules=mysheet .cssRules? mysheet.cssRule s[0]: mysheet.rules[0]
for (i=0; i<myrules.lengt h; i++){
if(myrules[i].selectorText.t oLowerCase()==" .heading"){ //find "a:hover" rule
targetrule=myru les[i]
targetrule.styl e.color = "<? echo $hclr ?> "
</script>
this is the code which chages stylesheet rules
is this correct and if it is correct where should i place it so that it can be executed before the page is displayed.
<style type="text/css">
.heading {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 15px;
color: #666699;
text-decoration: none;
font-style: normal;
font-weight: bolder;
text-align: center;
}
.message {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bolder;
color: #666699;
text-decoration: none;
}
.footer {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bolder;
color: #666699;
text-decoration: none;
}
</style>
This is my stylesheet
<script language="javas cript">
var mysheet=documen t.styleSheets[0]
var myrules=mysheet .cssRules? mysheet.cssRule s[0]: mysheet.rules[0]
for (i=0; i<myrules.lengt h; i++){
if(myrules[i].selectorText.t oLowerCase()==" .heading"){ //find "a:hover" rule
targetrule=myru les[i]
targetrule.styl e.color = "<? echo $hclr ?> "
</script>
this is the code which chages stylesheet rules
is this correct and if it is correct where should i place it so that it can be executed before the page is displayed.
Comment