Click to See Complete Forum and Search --> : Chrome Css Problem


gavshouse
03-23-2009, 11:03 AM
hi i noticed my ajax called cached .html files seem to be missing css so i made a quick example and i still cant find the problem.

This code is a simple version of my problem. In every browser once you click 2 it will load the number 2 and be blue where as in chrome it wont. i cant include the css in my main .css file so why is this ? is this not meeting standards ?

i thought it might be webkit but safari works so... ?

index.html
<html>
<head>
<link rel="stylesheet" href="default.css"/>
<script>
function js(nav_option) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Sorry but your browser is so old, you may have problems viewing this site")
return
}
if(nav_option==1){
url="1.html"
url=url+"?sid="+Math.random()
}else{
url="2.html"
url=url+"?sid="+Math.random()
}

xmlHttp.onreadystatechange = function() {
if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
document.getElementById("jsoutput").innerHTML=xmlHttp.responseText;
}
else{
//loading
}
}
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function GetXmlHttpObject(){
var xmlHttp=null;
try{
//Normal Browsers
xmlHttp=new XMLHttpRequest();
}
catch (e){
//**** Browers
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
</head>

<body>
<div id="navigation">
<a href="#" onClick="js('1');return false"/>1</a></br>
<a href="#" onClick="js('2');return false"/>2</a></br>
</div>
<div id="jsoutput"></div>
</body>
</html>

1.html
<div id="output">
<h3>1</h3>
</div>

2.html
<style type="text/css">
#output{
color:#0000FF;
}
</style>
<div id="output">
<h3>2</h3>
</div>

Fang
03-24-2009, 02:15 AM
Embedded style in the body is invalid; Chrome gets it right.