473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Modufying External stylesheet

190 100+
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="javascript">
var mysheet=document.styleSheets[0]
var myrules=mysheet.cssRules? mysheet.cssRules[0]: mysheet.rules[0]
for (i=0; i<myrules.length; i++){
if(myrules[i].selectorText.toLowerCase()==".heading"){ //find "a:hover" rule
targetrule=myrules[i]
targetrule.style.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.
Feb 9 '08 #1
1 1178
Hi,

You can modify external stylesheet ..

this script is not correct there are some small cheanges required.

<script language="javascript">
var mysheet=document.styleSheets[0]
var myrules=mysheet.cssRules? mysheet.cssRules[0]: mysheet.rules[0]
[SA] Change this lines if u want to used array then why are u used the CSS first element take all the element
var myrules=mysheet.cssRules? mysheet.cssRules: mysheet.rules


and every thing is all right if u want to executed before the page is displayed used in head elemnt show this is display before execution or may be used on onload event of the body..

Regards,
Sandeep Agarwal
Feb 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: allard poldermans | last post by:
How can I make a reference to an external CSS or JS file that is relative to the XSL stylesheet, and not relative to the XML data? If you simply put : <link rel="stylesheet" type="text/css"...
0
by: Shawn Modersohn | last post by:
Can someone give me the lowdown on the way these two browsers deal with the following <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="datadump.css"?> <!DOCTYPE...
12
by: Peter Collinson | last post by:
Hi... My external style sheet for a 200+ page site is marked up as: BODY, P, TABLE, TD, DIV { background: #ffffff; font-style: normal; font-variant: normal; font-weight: normal; font-size:...
6
by: Christopher Benson-Manica | last post by:
Just FMI, if an external stylesheet is linked to a page (with <link>), will subsequent <style> tags override the values in the external stylesheet? -- Christopher Benson-Manica | I *should*...
2
by: Markus Ernst | last post by:
Hi I build a small content management system. I use different external stylesheets for the admin section and the frontend, called admin.css and frontend.css. Now I would like to preview some...
7
by: David Filmer | last post by:
Greetings. I want to localize a style definition to a portion of an HTML document, but use an external stylesheet. It seems that I can only do <style><!-- @import...
26
by: HarryO | last post by:
I created an external stylesheet file 'styles.css' and an html file that includes the line: <LINK REL="stylesheet" TYPE="text/css" HREF="styles.css" Both the .css file and the html file reside...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
7
by: Dan Nash | last post by:
Hi I'm trying to create an external stylesheet for use in my Web App. It works fine, and I've got it linked and everything. The only problem is the "background-image" property isn't working. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.