Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer IE不';不要在DIV中使用外部CSS_Internet Explorer_Stylesheet - Fatal编程技术网

Internet explorer IE不';不要在DIV中使用外部CSS

Internet explorer IE不';不要在DIV中使用外部CSS,internet-explorer,stylesheet,Internet Explorer,Stylesheet,如果以前有人问过这个问题,请原谅,我找不到 我正在使用javascript将HTML文档转换为div。这是一个简化的代码 Chrome-23和FF-8使用ietest.css文件呈现HTML,但IE-9没有。使用 用iframe代替div是很困难的 欢迎提出任何建议 谢谢, 约翰在多伦多 <!-- Style sheet contents: p.bu1 {color: Blue; font-size:2em; font-weight:bold;} p.rd1 {color: Red; f

如果以前有人问过这个问题,请原谅,我找不到

我正在使用javascript将HTML文档转换为div。这是一个简化的代码

Chrome-23和FF-8使用ietest.css文件呈现HTML,但IE-9没有。使用 用iframe代替div是很困难的

欢迎提出任何建议

谢谢, 约翰在多伦多

<!--
Style sheet contents:
p.bu1 {color: Blue; font-size:2em; font-weight:bold;}
p.rd1 {color: Red;  font-size:2em; font-weight:bold;}
-->

<html>
<head>
<script>
function write_doc()
{
  document.getElementById('div').innerHTML = "<link rel='stylesheet' type='text/css' href='ietest.css?v=1'>\
   <p class='bu1'>BLUE</p><p class='rd1'>RED</p>";
}
</script>
</head>
<body>
<div id='div' onclick='write_doc()'>Click Me</div>
</body>
</html>

函数write_doc()
{
document.getElementById('div')。innerHTML=”\

”; } 点击我
谢谢蒂姆

我找到了一份工作

我在查询页面中加载了一个CSS文件(覆盖了大多数引用的样式),然后在将其发送到div之前,在HTML字符串中为其类的引用添加了一个前缀

e、 g


在CSS文件中: ... span.ie_虚拟{字体大小:0.1em;}

脚本:

var archdoc=“”+xmlhttp.responseText


(必须使用,空格字符无效。)


这要求我合并归档中的所有CSS文件,并消除任何歧义。我很想给IE用户留下不带样式的文本。也许他们会切换浏览器。

链接元素只能在IE中的head标记中使用: