【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>jQuery Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<h1>jQueryサンプル</h1>
<h2>jQueryとは?</h2>
<p class="normal">軽量/高速なライブラリです</p>
<form>
<input type="button" value="書き替え" onClick="changeCSS()">
</form>
</body>
</html>
【CSS】
h1 {
font-size:14pt;
border-bottom:1px dotted gray;
width:320px;
}
.normal {
color:black;
font-size:10pt;
font-weight:100;
background-color:#ddd;
}
.highlight {
color:red;
font-size:16pt;
font-weight:900;
}
【JavaScript】
function changeCSS(){
$("p").toggleClass("highlight");
}