|
|
1
9
|
|
|
2
3
“添加”样式表时,页面已呈现。这种类型的替换最好在服务器上完成。 |
|
|
3
0
|
|
|
4
0
使用jQuery切换样式表有一种非常好的技术 here . 它可以很容易地与你的随机化组合。 |
|
5
0
HI!
<script>
function getRand(){
return Math.round(Math.random()*(css.length-1));
}
var css = new Array(
'<link rel="stylesheet" type="text/css" href="1.css">',
'<link rel="stylesheet" type="text/css" href="2.css">',
'<link rel="stylesheet" type="text/css" href="3.css">',
'<link rel="stylesheet" type="text/css" href="4.css">'
);
rand = getRand();
document.write( "Choosing " + rand ) ;
document.write(css[rand]);
</script>
HELLO!
在1.css中 *
{
color: Red;
}
在2.css中 *
{
border: solid 2px green ;
}
在3.css中 *
{
font-size: 40em;
}
*
{
border: solid 5px red ;
}
|
|
|
6
0
除非出于某种原因必须在客户端执行,否则请在服务器上执行。 |
|
|
7
0
link元素必须位于head元素内部才能工作,document.createElement/element.append |
|
|
8
0
可能是吹毛求疵,但您可能想要:
|
|
|
9
0
如果您的CSS变化不大,您可以像我一样,在每次加载页面时随机生成CSS
|
|
|
code-geek · Jquery根据单选按钮选择隐藏或显示文本字段 1 年前 |
|
|
Alex · 在轻量级中同时解构和不解构变量 1 年前 |
|
|
Ângelo Rigo · ReactJS映射:如何迭代[关闭] 1 年前 |
|
|
bairog · 从按属性筛选的对象数组字典中创建值数组 1 年前 |
|
|
lokiuucx · JS对象属性返回未定义,尽管对象属性应该有值 1 年前 |