html radio onclick javascript

Onclick radio button menggunakan javascript

Bismillah

q> Langsung contoh codingnya :


<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>

Alhamdulillah

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s