我想創建一個帶有可移動動作的切換按鈕,就像它在黑暗的一面顯示它應該是黑暗的,並且如果它顯示爲輕的一面。任何機構都可以幫助你寫出如何寫成 。如何在jQuery中創建切換按鈕
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".styleswitch").click(function() {
$('link[rel=stylesheet]').attr('href' , $(this).attr('rel'));
});
});
</script>
<link rel="stylesheet" type="text/css" href="css/dark.css" />
<title>Switch Theme</title>
</head>
<body>
<a href="#" class="styleswitch" rel="css/dark.css">Dark</a>
<a href="#" class=" styleswitch " rel="css/light.css">Light</a>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<div id="module-a"><a href="#" class="styleswitch" rel="css/dark.css">Dark</a>
<a href="#" class=" styleswitch " rel="css/light.css">Light</a></div>
<div id="module-b">Module1</div>
<div id="module-c">Module1</div>
<div id="module-d">Module1</div>
</body>
</html>
你到目前爲止做了什麼?顯示一些代碼... – jackJoe 2012-03-21 11:43:57