0

我在我的网站上制作了 2 个样式表(白天和黑夜,因为我发现晚上在漆黑的房间里很难阅读全白背景样式)

我找到了样式切换开关,我希望在 css 切换器上使用它们。

<div class="switch switch-blue">
<input type="radio" class="switch-input" name="view2" value="week2" id="week2" checked>
<label for="week2" class="switch-label switch-label-off">Week</label>
<input type="radio" class="switch-input" name="view2" value="month2" id="month2">
<label for="month2" class="switch-label switch-label-on">Month</label>
<span class="switch-selection"></span>
</div>

如果我在文档中加载两个样式表

<a href="#" onclick="setActiveStyleSheet('default'); return false;">style 1</a> 
<a href="#" onclick="setActiveStyleSheet('alternate 1'); return false;">style 2</a>

如何使单选按钮在这两者之间切换?

谢谢

4

1 回答 1

0

您想将(例如)添加onclick="setActiveStyleSheet('default');"到您的<input type="radio">. 请注意,您不应该return false;在这种情况下使用,因为它会阻止收音机具有选定的外观。

于 2012-09-01T23:09:56.267 回答