2012-09-01 38 views
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> 

如何讓我的單選按鈕,這兩者之間進行切換兩個樣式?

感謝

回答

0

您要添加(例如)onclick="setActiveStyleSheet('default');"<input type="radio">。請注意,在這種情況下,您不應該使用return false;,因爲它會阻止收音機具有選定的外觀。