私のHTML
<html>
<head>
<link href="../../fuctions/style.css" rel="stylesheet" media="screen"
type="text/css" />
<script type="text/javascript" charset="utf-8" src="../../fuctions/cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="../../fuctions/functions.js"></script>
<script type="text/javascript" charset="utf-8" src="../../fuctions/jq.js"></script>
</head>
<body>
<div id="topbar">
<div id="title">
<!--Title-->After Landing</div>
<div id="leftnav"> <a href="../../index_aerosoft.html">Home</a>
<a href="katana_checklist_all.html">Overview</a>
<!--AllChecklist-->
</div>
<div id="rightnav"> <a href="katan_checklist_engineshut-downl.html" id="a_next">Next</a>
</div>
<!--NextPage-->
</div>
<div id="content">
<ul class="pageitem">
<li class="radiobutton" onClick="checkChanges()"> <span class="name">Wing Flaps -<font color="red"> UP
</font></span>
<input name="1" type="radio"
value="other" />
</li>
<!--CheckpunktEnd-->
<li class="radiobutton" onClick="checkChanges()"> <span class="name">Carburetor Heat -<font color="red"> OFF
</font></span>
<input name="2" type="radio"
value="other" />
</li>
<!--CheckpunktEnd-->
<li class="radiobutton" onClick="checkChanges()"> <span class="name">Exterior Lights -<font color="red"> as required
</font></span>
<input name="3" type="radio"
value="other" />
</li>
<!--CheckpunktEnd-->
<li class="radiobutton" onClick="checkChanges()"> <span class="name">Electric Fuel Pump -<font color="red"> OFF
</font></span>
<input name="4" type="radio"
value="other" />
</li>
<!--CheckpunktEnd-->
</ul>
</div>
<div id="footer"> <a class="noeffect" href="#" onClick="resetChecklist();">Reset Checklist</a>
<!--ResetChecklist-->
<br />
<br /> <a class="noeffect" href="#" onClick="openxyzDE();">xyz</a>
</div>
</body>
</html>
Javascript
function checkChanges() {
$('.radiobutton font').attr('color', 'red');
font = $('.radiobutton :checked').closest('.radiobutton').find('font')
if (this.flag) {
this.checked = false;
} else {
font.attr('color', 'green');
}
this.flag = !this.flag;
}
$(function () {
checkChanges();
$('.radiobutton :radio').on('click', checkChanges);
});
誰かがラジオボタンをクリックすると、チェックが外れて色が赤に戻りますが、色またはすべてがチェックされていない人の色のみを変更する必要があります。