【问题标题】:Changing styles of page using JS and CSS?使用 JS 和 CSS 更改页面样式?
【发布时间】:2010-10-25 10:31:17
【问题描述】:

我正在尝试使用 JS 在 head 标签内分配 CSS,但它不适用于 IE,知道为什么吗? IE 只显示“未知的运行时错误”。

<html>
<head>
<style id="style_id" type="text/css">
</style>
</head>
<body>
<p>This is the test Text</p>
</body>
<script>
    var st = document.getElementById("style_id");
    st.innerHTML = "p { color:red}";
</script>
</html>

【问题讨论】:

标签: javascript css


【解决方案1】:

您在寻找this 吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-12
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    • 2010-10-06
    • 2013-07-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多