Onclick radio button menggunakan javascript
Bismillah
q> Langsung contoh codingnya :
[sourcecode language="html"]
<html>
<head>
<title>Testing Radio Button</title>
<script type="text/javascript">
function pilih(radio) {
alert('nilai = ' + radio.value);
}
</script>
</head>
<body>
<form name="myform">
<input type="radio" name="radio" value="1" id="A" onclick="pilih(this);" /><label for="A">Pilihan A</label>
<input type="radio" name="radio" value="2" id="B" onclick="pilih(this);" /><label for="B">Pilihan B</label>
</form>
</body>
</html>
[/sourcecode]
Alhamdulillah
No comments:
Post a Comment