http://blog.codingwear.
com
PHP Ajax Javascript jQuery Tutorial
A. Penanganan CheckBox di javascript
Deteksi apakah checkbox sudah dicek
checkboxObject.checked=true|false
Contoh:
<html>
<head>
<script type="text/javascript">
function check(){
document.getElementById("myCheck").checked=true
}
function uncheck(){
document.getElementById("myCheck").checked=false
}
</script>
</head>
<body>
<form>
<input type="checkbox" id="myCheck" />
<input type="button" onclick="check()"
value="Check Checkbox" />
<input type="button" onclick="uncheck()"
value="Uncheck Checkbox" />
</form>
</body>
</html>
Mengambil Nilai checkbox
<html>
<head>
<script type="text/javascript">
function createOrder(){
coffee=document.forms[0].coffee
txt=""
for (i=0;i<coffee.length;++ i){
if (coffee[i].checked){
txt=txt + coffee[i].value + " "
}
}
document.getElementById("order").value="You ordered a coffee with " + txt
}
</script>
</head>
<body>
<p>How would you like your coffee?</p>
<form>
<input type="checkbox" name="coffee" value="cream">With cream<br />
<input type="checkbox" name="coffee" value="sugar">With sugar<br />
47