So Firefox will let me create an external style sheet reference and append it to the head once a response is received from an http request. IE however doesn't seem to take the style sheet instructions, though the DOM inspector does show that it has been appended to the document.
Here is an example of the problem, just click the "Pricing" tab.
http://www.rateprice.com/combo/pricefinal.asp
This is the xml page I am requesting:
http://www.rateprice.com/combo/pricing.asp
Once the response is received, I append both the js and css files to the head of the document using this code:
Code:
function loadURL(xml,str){
var doc=xml.documentElement;
var content=toXHTML(doc.getElementsByTagName('div')[0]);
clearNodes(document.getElementById('pagecontent'));
document.getElementById('pagecontent').appendChild(content);
var c_styles=document.getElementsByTagName('link');
var len1=c_styles.length;
var n_styles=doc.getElementsByTagName('link');
var len2=n_styles.length;
for(var i=0;i<len2;i++){
var s1=n_styles[i];
var flg=0;
for(var j=0;j<len1;j++){
var s2=c_styles[j];
if(s2.getAttribute('href').toLowerCase()==s1.getAttribute('href').toLowerCase()){
s2.parentNode.replaceChild(toXHTML(s1),s2);
flg=1;
}
}
if(flg==0){
document.getElementsByTagName('head')[0].appendChild(toXHTML(s1));
}
}
var c_scripts=document.getElementsByTagName('script');
var len1=c_scripts.length;
var n_scripts=doc.getElementsByTagName('script');
var len2=n_scripts.length;
for(var i=0;i<len2;i++){
var s1=n_scripts[i];
var flg=0;
for(var j=0;j<len1;j++){
var s2=c_scripts[j];
if(s2.getAttribute('src').toLowerCase()==s1.getAttribute('src').toLowerCase()){
s2.parentNode.replaceChild(toXHTML(s1),s2);
flg=1;
}
}
if(flg==0){
document.getElementsByTagName('head')[0].appendChild(toXHTML(s1));
}
}
}
The javascript appended to the document goes off without a hitch in both browsers, however the css:
Code:
#pricingnav{
margin:0px;
padding:0px;
width:100%;
list-style:none;
height:18px;
margin-top:10px;
}
#pricingnav li{
float:left;
margin-left:15px;
}
#pricingnav li a{
display:block;
height:100%;
width:100%;
font-size:.8em;
background-color:#D6E7F7;
text-decoration:none;
text-align:center;
border:solid 1px;
padding:0px 5px 0px 5px;
}
Only takes effect in Firefox.
Any suggestions on how to get the style sheet to take in IE7?
Thanks,
Basscyst