Link to home
Start Free TrialLog in
Avatar of paddycobbett
paddycobbett

asked on

Is it possible to overwrite styles declared in the head?

I need to overwrite styles declared in the head, to simplify and avoid doubt about what i mean:

<html>
<head>
<style id='tmplcss'> .. some css .. </style>
</head>
<body>
.. etc etc

Notice i've given the <style> tag an id, which successfully allows me to reference it, and even query it's content. HOWEVER, to my disappointment i'm NOT able to replace the inner content.

var g=document.getElementById('tmplcss');
alert(g.innerHTML);

"Alerts" the css content no problem, however:
      
g.innerHTML="";

.. has no effect, and think is illegal. Before i choose another course of action i wanted to know if what i'm trying to do is possible. I basically want to overwrite the css with some new css, in the hope that the page reflects the css changes. Can anyone explain how this is done, or perhaps explain why this isn't supproted, or is it just not supported yet?? I've only tested on my current browser IE7.

Thanks
SOLUTION
Avatar of niko86
niko86

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial