我写文本使用document.write的Chrome扩展页面,但没有应用相关的自定义CSS:CSS没有被应用到文件撰写文本
<!DOCTYPE html>
<html>
<head>
<title>TITLE GOES HERE</title>
<link rel="stylesheet" href="css/popup.css" type="text/css" />
</head>
<body>
<script type="text/javascript">
...
function showFolder(folder) {
console.debug('FOLDER: '+folder.title);
document.write('<p>'+folder.title+'<br></p>');
}
</script>
</body>
</html>
的CSS很简单,只是为了调试:
p {
color: red;
}
我可以得到它,如果我把功能showFolder里面的样式表的链接工作,但不能做到这一点的正确方法。我正在学习jscript/CSS,所以答案可能是补救措施。问题在jscript,CSS或两者?
你在哪里调用`showFolder`?你有另一个样式表可能会冲突并覆盖样式吗?我测试了你在这里的功能,如果你在函数声明之后调用`showFolder`而不是``` – 2011-01-25 03:45:23
showFolder从另一个函数(...)中调用,它读取Chrome书签中的文件夹(基本上是'读取书签树' - >'如果item是文件夹,则通过showFolder显示文件夹的名称)。只是为了踢我移动showFolder声明之前......功能,但问题依然存在。 – hideyho 2011-01-25 04:11:32